2021-03-22 05:19:47 -07:00
|
|
|
pkgs:
|
2020-01-12 11:52:40 -08:00
|
|
|
let
|
2022-10-22 10:37:47 -07:00
|
|
|
pythonTesting = import (pkgs.path + "/nixos/lib/testing-python.nix") {
|
2021-03-22 05:19:48 -07:00
|
|
|
system = pkgs.stdenv.hostPlatform.system;
|
2021-03-22 05:19:47 -07:00
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
in
|
2020-01-12 11:52:40 -08:00
|
|
|
|
2022-12-18 04:13:44 -08:00
|
|
|
module:
|
2021-03-22 05:19:47 -07:00
|
|
|
let
|
2022-12-18 04:13:44 -08:00
|
|
|
test = (pythonTesting.evalTest module).config;
|
2020-01-12 11:52:40 -08:00
|
|
|
|
2022-12-18 04:13:44 -08:00
|
|
|
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
|
2021-03-22 05:19:47 -07:00
|
|
|
buildCommand = ''
|
2022-08-16 12:00:00 -07:00
|
|
|
mkdir "$out"
|
2021-08-04 15:49:08 -07:00
|
|
|
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
|
2022-08-16 12:00:00 -07:00
|
|
|
ln -s ${test.driver} "$out/driver"
|
2021-03-22 05:19:47 -07:00
|
|
|
'';
|
2022-12-18 04:13:44 -08:00
|
|
|
|
|
|
|
inherit (test) meta passthru;
|
|
|
|
} // test;
|
2020-01-12 11:52:40 -08:00
|
|
|
in
|
2022-12-18 04:13:44 -08:00
|
|
|
runTest
|