1<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-running-nixos-tests">
2 <title>Running Tests</title>
3 <para>
4 You can run tests using <literal>nix-build</literal>. For example,
5 to run the test
6 <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix"><literal>login.nix</literal></link>,
7 you do:
8 </para>
9 <programlisting>
10$ cd /my/git/clone/of/nixpkgs
11$ nix-build -A nixosTests.login
12</programlisting>
13 <para>
14 After building/downloading all required dependencies, this will
15 perform a build that starts a QEMU/KVM virtual machine containing a
16 NixOS system. The virtual machine mounts the Nix store of the host;
17 this makes VM creation very fast, as no disk image needs to be
18 created. Afterwards, you can view a log of the test:
19 </para>
20 <programlisting>
21$ nix-store --read-log result
22</programlisting>
23</section>