test: update to NixOS 22.11

This commit is contained in:
Erik Arvstedt 2022-12-18 13:13:44 +01:00 committed by Greg Shuflin
parent 7a2c1efd5d
commit 2e5b287bc8
3 changed files with 17 additions and 11 deletions

View File

@ -6,20 +6,25 @@ let
}; };
in in
args: module:
let let
test = pythonTesting.makeTest args; test = (pythonTesting.evalTest module).config;
# 1. Save test logging output runTest = pkgs.stdenv.mkDerivation {
# 2. Add link to driver so that a gcroot to a test prevents the driver from name = "vm-test-run-${test.name}";
# being garbage-collected
fixedTest = test.overrideAttrs (_: { requiredSystemFeatures = [ "kvm" "nixos-test" ];
# See `runTests` in nixpkgs/nixos/lib/testing-python.nix for the original definition of `buildCommand`
# 1. Save test logging output
# 2. Add link to driver so that a gcroot to a test prevents the driver from
# being garbage-collected
buildCommand = '' buildCommand = ''
mkdir "$out" mkdir "$out"
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
ln -s ${test.driver} "$out/driver" ln -s ${test.driver} "$out/driver"
''; '';
});
inherit (test) meta passthru;
} // test;
in in
fixedTest runTest

View File

@ -47,7 +47,7 @@ let
# is_interactive is set in ./run-vm.sh # is_interactive is set in ./run-vm.sh
'' ''
if not "is_interactive" in vars(): if not "is_interactive" in vars():
run_tests() nb_run_tests()
'' ''
]; ];
}; };

View File

@ -48,7 +48,8 @@ def test(name):
tests[name] = fn tests[name] = fn
return x return x
def run_tests(): # `run_tests` is already defined by the NixOS test driver
def nb_run_tests():
enabled = enabled_tests.copy() enabled = enabled_tests.copy()
to_run = [] to_run = []
for test in tests: for test in tests: