···99 The test itself can be run interactively. This is particularly useful when
1010 developing or debugging a test:
1111<screen>
1212-<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driver
1212+<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driverInteractive
1313<prompt>$ </prompt>./result/bin/nixos-test-driver
1414starting VDE switch for network 1
1515<prompt>></prompt>
···3030 <para>
3131 To just start and experiment with the VMs, run:
3232<screen>
3333-<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driver
3333+<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driverInteractive
3434<prompt>$ </prompt>./result/bin/nixos-run-vms
3535</screen>
3636 The script <command>nixos-run-vms</command> starts the virtual machines
+14-6
nixos/lib/testing-python.nix
···1717 inherit pkgs;
181819192020- testDriver = let
2020+ mkTestDriver = let
2121 testDriverScript = ./test-driver/test-driver.py;
2222- in stdenv.mkDerivation {
2222+ in qemu_pkg: stdenv.mkDerivation {
2323 name = "nixos-test-driver";
24242525 nativeBuildInputs = [ makeWrapper ];
···4747 # TODO: copy user script part into this file (append)
48484949 wrapProgram $out/bin/nixos-test-driver \
5050- --prefix PATH : "${lib.makeBinPath [ qemu_test vde2 netpbm coreutils ]}" \
5050+ --prefix PATH : "${lib.makeBinPath [ qemu_pkg vde2 netpbm coreutils ]}" \
5151 '';
5252 };
53535454+ testDriver = mkTestDriver qemu_test;
5555+ testDriverInteractive = mkTestDriver qemu_kvm;
54565557 # Run an automated test suite in the given virtual network.
5658 # `driver' is the script that runs the network.
···113115 # Generate convenience wrappers for running the test driver
114116 # interactively with the specified network, and for starting the
115117 # VMs from the command line.
116116- driver = let warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; in warn (runCommand testDriverName
118118+ driver = testDriver:
119119+ let
120120+ warn = if skipLint then lib.warn "Linting is disabled!" else lib.id;
121121+ in
122122+ warn (runCommand testDriverName
117123 { buildInputs = [ makeWrapper];
118124 testScript = testScript';
119125 preferLocalBuild = true;
···148154 meta = (drv.meta or {}) // t.meta;
149155 };
150156151151- test = passMeta (runTests driver);
157157+ test = passMeta (runTests (driver testDriver));
152158153159 nodeNames = builtins.attrNames nodes;
154160 invalidNodeNames = lib.filter
···165171 ''
166172 else
167173 test // {
168168- inherit nodes driver test;
174174+ inherit nodes test;
175175+ driver = driver testDriver;
176176+ driverInteractive = driver testDriverInteractive;
169177 };
170178171179 runInMachine =
+4
nixos/modules/testing/test-instrumentation.nix
···116116 users.users.root.initialHashedPassword = mkOverride 150 "";
117117118118 services.xserver.displayManager.job.logToJournal = true;
119119+120120+ # Make sure we use the Guest Agent from the QEMU package for testing
121121+ # to reduce the closure size required for the tests.
122122+ services.qemuGuest.package = pkgs.qemu_test.ga;
119123 };
120124121125}