1<section xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:xi="http://www.w3.org/2001/XInclude"
4 version="5.0"
5 xml:id="sec-running-nixos-tests">
6<title>Running Tests interactively</title>
7
8<para>The test itself can be run interactively. This is
9particularly useful when developing or debugging a test:
10
11<screen>
12$ nix-build nixos/tests/login.nix -A driver
13$ ./result/bin/nixos-test-driver
14starting VDE switch for network 1
15>
16</screen>
17
18You can then take any Perl statement, e.g.
19
20<screen>
21> startAll
22> testScript
23> $machine->succeed("touch /tmp/foo")
24</screen>
25
26The function <command>testScript</command> executes the entire test
27script and drops you back into the test driver command line upon its
28completion. This allows you to inspect the state of the VMs after the
29test (e.g. to debug the test script).</para>
30
31<para>To just start and experiment with the VMs, run:
32
33<screen>
34$ nix-build nixos/tests/login.nix -A driver
35$ ./result/bin/nixos-run-vms
36</screen>
37
38The script <command>nixos-run-vms</command> starts the virtual
39machines defined by test. The root file system of the VMs is created
40on the fly and kept across VM restarts in
41<filename>./</filename><varname>hostname</varname><filename>.qcow2</filename>.</para>
42
43</section>