diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index 43b4f9b159b2..7c8c64211f18 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -257,105 +257,18 @@ rec { inherit test driver driverInteractive nodes; }; - runInMachine = - { drv - , machine - , preBuild ? "" - , postBuild ? "" - , qemu_pkg ? pkgs.qemu_test - , ... # ??? - }: - let - build-vms = import ./build-vms.nix { - inherit system pkgs minimal specialArgs extraConfigurations; - }; - vm = build-vms.buildVM { } - [ - machine - { - key = "run-in-machine"; - networking.hostName = "client"; - nix.readOnlyStore = false; - virtualisation.writableStore = false; - } - ]; + abortForFunction = functionName: abort ''The ${functionName} function was + removed because it is not an essential part of the NixOS testing + infrastructure. It had no usage in NixOS or Nixpkgs and it had no designated + maintainer. You are free to reintroduce it by documenting it in the manual + and adding yourself as maintainer. It was removed in + https://github.com/NixOS/nixpkgs/pull/137013 + ''; - buildrunner = writeText "vm-build" '' - source $1 - - ${coreutils}/bin/mkdir -p $TMPDIR - cd $TMPDIR - - exec $origBuilder $origArgs - ''; - - testScript = '' - start_all() - client.wait_for_unit("multi-user.target") - ${preBuild} - client.succeed("env -i ${bash}/bin/bash ${buildrunner} /tmp/xchg/saved-env >&2") - ${postBuild} - client.succeed("sync") # flush all data before pulling the plug - ''; - - testDriver = pythonTestDriver { inherit qemu_pkg; }; - - vmRunCommand = writeText "vm-run" '' - xchg=vm-state-client/xchg - ${coreutils}/bin/mkdir $out - ${coreutils}/bin/mkdir -p $xchg - - for i in $passAsFile; do - i2=''${i}Path - _basename=$(${coreutils}/bin/basename ''${!i2}) - ${coreutils}/bin/cp ''${!i2} $xchg/$_basename - eval $i2=/tmp/xchg/$_basename - ${coreutils}/bin/ls -la $xchg - done - - unset i i2 _basename - export | ${gnugrep}/bin/grep -v '^xchg=' > $xchg/saved-env - unset xchg - - export tests='${testScript}' - ${testDriver}/bin/nixos-test-driver --keep-vm-state ${vm.config.system.build.vm}/bin/run-*-vm - ''; # */ - - in - lib.overrideDerivation drv (attrs: { - requiredSystemFeatures = [ "kvm" ]; - builder = "${bash}/bin/sh"; - args = [ "-e" vmRunCommand ]; - origArgs = attrs.args; - origBuilder = attrs.builder; - }); - - - runInMachineWithX = { require ? [ ], ... } @ args: - let - client = - { ... }: - { - inherit require; - imports = [ - ../tests/common/auto.nix - ]; - virtualisation.memorySize = 1024; - services.xserver.enable = true; - test-support.displayManager.auto.enable = true; - services.xserver.displayManager.defaultSession = "none+icewm"; - services.xserver.windowManager.icewm.enable = true; - }; - in - runInMachine ({ - machine = client; - preBuild = - '' - client.wait_for_x() - ''; - } // args); + runInMachine = abortForFunction "runInMachine"; + runInMachineWithX = abortForFunction "runInMachineWithX"; simpleTest = as: (makeTest as).test; diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 6baa986b2bda..48d98ee8b6fe 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -385,7 +385,6 @@ in rspamd = handleTest ./rspamd.nix {}; rss2email = handleTest ./rss2email.nix {}; rsyslogd = handleTest ./rsyslogd.nix {}; - runInMachine = handleTest ./run-in-machine.nix {}; rxe = handleTest ./rxe.nix {}; samba = handleTest ./samba.nix {}; samba-wsdd = handleTest ./samba-wsdd.nix {}; diff --git a/nixos/tests/run-in-machine.nix b/nixos/tests/run-in-machine.nix deleted file mode 100644 index 67840f3e9fe7..000000000000 --- a/nixos/tests/run-in-machine.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ system ? builtins.currentSystem, - config ? {}, - pkgs ? import ../.. { inherit system config; } -}: - -with import ../lib/testing-python.nix { inherit system pkgs; }; - -let - output = runInMachine { - drv = pkgs.hello; - machine = { ... }: { /* services.sshd.enable = true; */ }; - }; - - test = pkgs.runCommand "verify-output" { inherit output; } '' - if [ ! -e "$output/bin/hello" ]; then - echo "Derivation built using runInMachine produced incorrect output:" >&2 - ls -laR "$output" >&2 - exit 1 - fi - "$output/bin/hello" > "$out" - ''; - -in test // { inherit test; } # To emulate behaviour of makeTest