diff options
author | David Arnold <dar@xoe.solutions> | 2021-06-06 12:00:12 -0500 |
---|---|---|
committer | David Arnold <dgx.arnold@gmail.com> | 2021-08-05 19:07:11 -0500 |
commit | 926fb9396881202e727e5ec1fbf609b64455b388 (patch) | |
tree | ed0325450bfa2982cbc008edc6b5b70a78458985 /nixos/lib/testing-python.nix | |
parent | 077b2825cd3328f83dbc1774ce62751dae4cb719 (diff) |
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.nix | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index 768f1dc2a170..87a30f7f8b72 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 |