nix-bitcoin/test/lib/make-test-vm.nix

26 lines
716 B
Nix
Raw Permalink Normal View History

pkgs:
let
pythonTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
system = pkgs.stdenv.hostPlatform.system;
inherit pkgs;
};
in
args:
let
test = pythonTesting.makeTest args;
# 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`
buildCommand = ''
mkdir "$out"
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
ln -s ${test.driver} "$out/driver"
'';
});
in
fixedTest