2015-04-21 08:27:40 +02:00
|
|
|
<section xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
version="5.0"
|
|
|
|
xml:id="sec-running-nixos-tests">
|
2018-05-02 01:57:09 +02:00
|
|
|
<title>Running Tests interactively</title>
|
2015-04-21 08:27:40 +02:00
|
|
|
|
2018-05-02 01:57:09 +02:00
|
|
|
<para>
|
|
|
|
The test itself can be run interactively. This is particularly useful when
|
|
|
|
developing or debugging a test:
|
2015-04-21 08:27:40 +02:00
|
|
|
<screen>
|
|
|
|
$ nix-build nixos/tests/login.nix -A driver
|
|
|
|
$ ./result/bin/nixos-test-driver
|
|
|
|
starting VDE switch for network 1
|
|
|
|
>
|
|
|
|
</screen>
|
2018-05-02 01:57:09 +02:00
|
|
|
You can then take any Perl statement, e.g.
|
2015-04-21 08:27:40 +02:00
|
|
|
<screen>
|
|
|
|
> startAll
|
|
|
|
> testScript
|
|
|
|
> $machine->succeed("touch /tmp/foo")
|
|
|
|
</screen>
|
2018-05-02 01:57:09 +02:00
|
|
|
The function <command>testScript</command> executes the entire test script
|
|
|
|
and drops you back into the test driver command line upon its completion.
|
|
|
|
This allows you to inspect the state of the VMs after the test (e.g. to debug
|
|
|
|
the test script).
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To just start and experiment with the VMs, run:
|
2015-04-21 08:27:40 +02:00
|
|
|
<screen>
|
|
|
|
$ nix-build nixos/tests/login.nix -A driver
|
|
|
|
$ ./result/bin/nixos-run-vms
|
|
|
|
</screen>
|
2018-05-02 01:57:09 +02:00
|
|
|
The script <command>nixos-run-vms</command> starts the virtual machines
|
|
|
|
defined by test. The root file system of the VMs is created on the fly and
|
|
|
|
kept across VM restarts in
|
|
|
|
<filename>./</filename><varname>hostname</varname><filename>.qcow2</filename>.
|
|
|
|
</para>
|
2015-04-21 08:27:40 +02:00
|
|
|
</section>
|