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-interactively">
6 <title>Running Tests</title>
7
8 <para>
9 You can run tests using <command>nix-build</command>. For example, to run the
10 test
11 <filename
12xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix">login.nix</filename>,
13 you just do:
14<screen>
15$ nix-build '<nixpkgs/nixos/tests/login.nix>'
16</screen>
17 or, if you don’t want to rely on <envar>NIX_PATH</envar>:
18<screen>
19$ cd /my/nixpkgs/nixos/tests
20$ nix-build login.nix
21…
22running the VM test script
23machine: QEMU running (pid 8841)
24…
256 out of 6 tests succeeded
26</screen>
27 After building/downloading all required dependencies, this will perform a
28 build that starts a QEMU/KVM virtual machine containing a NixOS system. The
29 virtual machine mounts the Nix store of the host; this makes VM creation very
30 fast, as no disk image needs to be created. Afterwards, you can view a
31 pretty-printed log of the test:
32<screen>
33$ firefox result/log.html
34</screen>
35 </para>
36</section>