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>
9 The test itself can be run interactively. This is particularly useful when
10 developing or debugging a test:
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 You can then take any Perl statement, e.g.
18<screen>
19> startAll
20> testScript
21> $machine->succeed("touch /tmp/foo")
22</screen>
23 The function <command>testScript</command> executes the entire test script
24 and drops you back into the test driver command line upon its completion.
25 This allows you to inspect the state of the VMs after the test (e.g. to debug
26 the test script).
27 </para>
28
29 <para>
30 To just start and experiment with the VMs, run:
31<screen>
32$ nix-build nixos/tests/login.nix -A driver
33$ ./result/bin/nixos-run-vms
34</screen>
35 The script <command>nixos-run-vms</command> starts the virtual machines
36 defined by test. The root file system of the VMs is created on the fly and
37 kept across VM restarts in
38 <filename>./</filename><varname>hostname</varname><filename>.qcow2</filename>.
39 </para>
40</section>