testing framework: re-add features removed in nixpkgs 20.09

Since nixpks 20.09, the test output is just an empty directory.
Restore saving the log output and linking to the driver.

Without linking to the driver, the driver is eligible for
garbage collection after running a test via `run-tests.sh --out-link-prefix`,
which implies lengthy driver rebuilds.
This commit is contained in:
Erik Arvstedt 2020-11-11 15:12:05 +01:00
parent eda6dcfde3
commit 7e3d2965a5
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -19,7 +19,19 @@ let
'';
};
};
test' = test (args // { pkgs = pkgsFixed; });
in
test (args // { pkgs = pkgsFixed; });
# See nixpkgs/nixos/lib/testing-python.nix for the original definition
test'.overrideAttrs (_: {
# 1. Save test 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') nodes driver; } ;
in
fixedTest