summary refs log tree commit diff
path: root/nixos/lib/testing-python.nix
diff options
context:
space:
mode:
authorDavid Arnold <dar@xoe.solutions>2021-06-06 12:00:12 -0500
committerDavid Arnold <dgx.arnold@gmail.com>2021-08-05 19:07:11 -0500
commit926fb9396881202e727e5ec1fbf609b64455b388 (patch)
treeed0325450bfa2982cbc008edc6b5b70a78458985 /nixos/lib/testing-python.nix
parent077b2825cd3328f83dbc1774ce62751dae4cb719 (diff)
downloadnixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar.gz
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar.bz2
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar.lz
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar.xz
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.tar.zst
nixpkgs-926fb9396881202e727e5ec1fbf609b64455b388.zip
nixos/tests/test-driver: normalise test driver entrypoint(s)
Previously the driver was configured exclusively through convoluted
environment variables.

Now the driver's defaults are configured through env variables.

Some additional concerns are in the github comments of this PR.
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r--nixos/lib/testing-python.nix23
1 files changed, 12 insertions, 11 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index 768f1dc2a17..87a30f7f8b7 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -83,7 +83,10 @@ rec {
         ''
           mkdir -p $out
 
-          LOGFILE=/dev/null tests='exec(os.environ["testScript"])' ${driver}/bin/nixos-test-driver
+          # effectively mute the XMLLogger
+          export LOGFILE=/dev/null
+
+          ${driver}/bin/nixos-test-driver
         '';
 
       passthru = driver.passthru // {
@@ -161,7 +164,10 @@ rec {
       ''
         mkdir -p $out/bin
 
+        vmStartScripts=($(for i in ${toString vms}; do echo $i/bin/run-*-vm; done))
         echo -n "$testScript" > $out/test-script
+        ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-test-driver
+
         ${lib.optionalString (!skipLint) ''
           PYFLAKES_BUILTINS="$(
             echo -n ${lib.escapeShellArg (lib.concatStringsSep "," nodeHostNames)},
@@ -169,17 +175,12 @@ rec {
           )" ${python3Packages.pyflakes}/bin/pyflakes $out/test-script
         ''}
 
-        ln -s ${testDriver}/bin/nixos-test-driver $out/bin/
-        vms=($(for i in ${toString vms}; do echo $i/bin/run-*-vm; done))
+        # set defaults through environment
+        # see: ./test-driver/test-driver.py argparse implementation
         wrapProgram $out/bin/nixos-test-driver \
-          --add-flags "''${vms[*]}" \
-          --run "export testScript=\"\$(${coreutils}/bin/cat $out/test-script)\"" \
-          --set VLANS '${toString vlans}'
-        ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
-        wrapProgram $out/bin/nixos-run-vms \
-          --add-flags "''${vms[*]}" \
-          --set tests 'start_all(); join_all();' \
-          --set VLANS '${toString vlans}'
+          --set startScripts "''${vmStartScripts[*]}" \
+          --set testScript "$out/test-script" \
+          --set vlans '${toString vlans}'
       '');
 
   # Make a full-blown test