test: update to NixOS 22.11

This commit is contained in:
Erik Arvstedt 2022-12-18 13:13:44 +01:00
parent 142cbcfb37
commit 77d58162e7
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 17 additions and 11 deletions

View File

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

View File

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

View File

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