···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
9+particularly 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
14+starting VDE switch for network 1
15+>
16+</screen>
17+18+You can then take any Perl statement, e.g.
19+20+<screen>
21+> startAll
22+> testScript
23+> $machine->succeed("touch /tmp/foo")
24+</screen>
25+26+The function <command>testScript</command> executes the entire test
27+script and drops you back into the test driver command line upon its
28+completion. This allows you to inspect the state of the VMs after the
29+test (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+38+The script <command>nixos-run-vms</command> starts the virtual
39+machines defined by test. The root file system of the VMs is created
40+on the fly and kept across VM restarts in
41+<filename>./</filename><varname>hostname</varname><filename>.qcow2</filename>.</para>
42+43+</section>
···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">
67<title>Running Tests</title>
8···38</screen>
3940</para>
41-42-<title>Running Tests interactively</title>
43-44-<para>The test itself can be run interactively. This is
45-particularly useful when developing or debugging a test:
46-47-<screen>
48-$ nix-build nixos/tests/login.nix -A driver
49-$ ./result/bin/nixos-test-driver
50-starting VDE switch for network 1
51->
52-</screen>
53-54-You can then take any Perl statement, e.g.
55-56-<screen>
57-> startAll
58-> testScript
59-> $machine->succeed("touch /tmp/foo")
60-</screen>
61-62-The function <command>testScript</command> executes the entire test
63-script and drops you back into the test driver command line upon its
64-completion. This allows you to inspect the state of the VMs after the
65-test (e.g. to debug the test script).</para>
66-67-<para>To just start and experiment with the VMs, run:
68-69-<screen>
70-$ nix-build nixos/tests/login.nix -A driver
71-$ ./result/bin/nixos-run-vms
72-</screen>
73-74-The script <command>nixos-run-vms</command> starts the virtual
75-machines defined by test. The root file system of the VMs is created
76-on the fly and kept across VM restarts in
77-<filename>./</filename><varname>hostname</varname><filename>.qcow2</filename>.</para>
78-79</section>