diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2020-10-05 15:52:27 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2020-10-19 17:39:48 +0200 |
commit | c096880d46115c43ea254efc52de32dc3fe58913 (patch) | |
tree | 5d8be6be204ab532d656c1096394b4b2a3776717 /nixos/lib | |
parent | e79eed4840f9064c50259143b722c603d8006f84 (diff) |
nixos/tests: make the `driver` attribute use a rich qemu
Since we previously stripped down the features of `qemu_test` some of
the features users are used to while running tests through the (impure)
driver didn't work anymore. Most notably we lost support for graphical
output and audio. With this change the `driver` attribute uses are more
feature complete version of QEmu compared to the one used in the pure
Nix builds.
This gives us the best of both worlds. Users are able to see the
graphical windows of VMs while CI and regular nix builds do not have to
download all the (unnecessary) dependencies.
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/testing-python.nix | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index 498f97336c02..69cad8cdceb1 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -17,9 +17,9 @@ rec { inherit pkgs; - testDriver = let + mkTestDriver = let testDriverScript = ./test-driver/test-driver.py; - in stdenv.mkDerivation { + in qemu_pkg: stdenv.mkDerivation { name = "nixos-test-driver"; nativeBuildInputs = [ makeWrapper ]; @@ -47,10 +47,12 @@ rec { # TODO: copy user script part into this file (append) wrapProgram $out/bin/nixos-test-driver \ - --prefix PATH : "${lib.makeBinPath [ qemu_test vde2 netpbm coreutils ]}" \ + --prefix PATH : "${lib.makeBinPath [ qemu_pkg vde2 netpbm coreutils ]}" \ ''; }; + testDriver = mkTestDriver qemu_test; + testDriverInteractive = mkTestDriver qemu_kvm; # Run an automated test suite in the given virtual network. # `driver' is the script that runs the network. @@ -113,7 +115,11 @@ rec { # Generate convenience wrappers for running the test driver # interactively with the specified network, and for starting the # VMs from the command line. - driver = let warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; in warn (runCommand testDriverName + driver = testDriver: + let + warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; + in + warn (runCommand testDriverName { buildInputs = [ makeWrapper]; testScript = testScript'; preferLocalBuild = true; @@ -148,7 +154,7 @@ rec { meta = (drv.meta or {}) // t.meta; }; - test = passMeta (runTests driver); + test = passMeta (runTests (driver testDriver)); nodeNames = builtins.attrNames nodes; invalidNodeNames = lib.filter @@ -165,7 +171,8 @@ rec { '' else test // { - inherit nodes driver test; + inherit nodes test; + driver = driver testDriverInteractive; }; runInMachine = |