summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Kenigsberg <matthewkenigsberg@gmail.com>2021-09-07 11:36:11 -0500
committerMatthew Kenigsberg <matthewkenigsberg@gmail.com>2021-09-08 06:25:20 -0500
commitb00d2a8f3e716dcb619ea8168098ffc8786fe007 (patch)
treef4061402ed6a76712820d07d967bac7c9a7f7a59
parentbc06c93905f60a82d6ebbb78f78cf289257860cc (diff)
downloadnixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar.gz
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar.bz2
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar.lz
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar.xz
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.tar.zst
nixpkgs-b00d2a8f3e716dcb619ea8168098ffc8786fe007.zip
nixos/testing: remove unused function runInMachine
runInMachine and runInMachineWithX are not used for any tests and can be
removed
-rw-r--r--nixos/lib/testing-python.nix105
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/run-in-machine.nix23
3 files changed, 9 insertions, 120 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index 43b4f9b159b..7c8c64211f1 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;
-          }
-        ];
-
-      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
+  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
+  '';
 
-        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 6baa986b2bd..48d98ee8b6f 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 67840f3e9fe..00000000000
--- 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