git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: nixos/doc/manual/development/running-nixos-tests.xml to CommonMark
commit8fafcfa3ea8730b9e265fd0d4f605fd86897b116 authorBobby Rong <rjl931189261@126.com> dateFri 2 Jul 2021, 20:23 (5 years ago) parent163976c
4 files changed+66−37
nixos/doc/manual/development/nixos-tests.xml+1−1 nixos/doc/manual/development/running-nixos-tests.section.md+31 nixos/doc/manual/development/running-nixos-tests.xml−36 nixos/doc/manual/from_md/development/running-nixos-tests.section.xml+34
nixos/doc/manual/development/nixos-tests.xml+1−1
@@ -14,6 +14,6 @@ xlink:href="https://github.com/NixOS/nixpkgs/tree/master/nixos/tests">nixos/test
1414 test.
1515 </para>
1616 <xi:include href="../from_md/development/writing-nixos-tests.section.xml" />
17− <xi:include href="running-nixos-tests.xml" />
17+ <xi:include href="../from_md/development/running-nixos-tests.section.xml" />
1818 <xi:include href="running-nixos-tests-interactively.xml" />
1919</chapter>
nixos/doc/manual/development/running-nixos-tests.section.mdnew file+31
@@ -0,0 +1,31 @@
1+# Running Tests {#sec-running-nixos-tests}
2+
3+You can run tests using `nix-build`. For example, to run the test
4+[`login.nix`](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix),
5+you just do:
6+
7+```ShellSession
8+$ nix-build '<nixpkgs/nixos/tests/login.nix>'
9+```
10+
11+or, if you don't want to rely on `NIX_PATH`:
12+
13+```ShellSession
14+$ cd /my/nixpkgs/nixos/tests
15+$ nix-build login.nix
16+…
17+running the VM test script
18+machine: QEMU running (pid 8841)
19+…
20+6 out of 6 tests succeeded
21+```
22+
23+After building/downloading all required dependencies, this will perform
24+a build that starts a QEMU/KVM virtual machine containing a NixOS
25+system. The virtual machine mounts the Nix store of the host; this makes
26+VM creation very fast, as no disk image needs to be created. Afterwards,
27+you can view a pretty-printed log of the test:
28+
29+```ShellSession
30+$ firefox result/log.html
31+```
nixos/doc/manual/development/running-nixos-tests.xmldeleted−36
@@ -1,36 +0,0 @@
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</title>
7−
8− <para>
9− You can run tests using <command>nix-build</command>. For example, to run the
10− test
11− <filename
12−xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix">login.nix</filename>,
13− you just do:
14−<screen>
15−<prompt>$ </prompt>nix-build '&lt;nixpkgs/nixos/tests/login.nix>'
16−</screen>
17− or, if you don’t want to rely on <envar>NIX_PATH</envar>:
18−<screen>
19−<prompt>$ </prompt>cd /my/nixpkgs/nixos/tests
20−<prompt>$ </prompt>nix-build login.nix
21−…
22−running the VM test script
23−machine: QEMU running (pid 8841)
24−…
25−6 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−<prompt>$ </prompt>firefox result/log.html
34−</screen>
35− </para>
36−</section>
nixos/doc/manual/from_md/development/running-nixos-tests.section.xmlnew file+34
@@ -0,0 +1,34 @@
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 just do:
8+ </para>
9+ <programlisting>
10+$ nix-build '&lt;nixpkgs/nixos/tests/login.nix&gt;'
11+</programlisting>
12+ <para>
13+ or, if you don’t want to rely on <literal>NIX_PATH</literal>:
14+ </para>
15+ <programlisting>
16+$ cd /my/nixpkgs/nixos/tests
17+$ nix-build login.nix
18+…
19+running the VM test script
20+machine: QEMU running (pid 8841)
21+…
22+6 out of 6 tests succeeded
23+</programlisting>
24+ <para>
25+ After building/downloading all required dependencies, this will
26+ perform a build that starts a QEMU/KVM virtual machine containing a
27+ NixOS system. The virtual machine mounts the Nix store of the host;
28+ this makes VM creation very fast, as no disk image needs to be
29+ created. Afterwards, you can view a pretty-printed log of the test:
30+ </para>
31+ <programlisting>
32+$ firefox result/log.html
33+</programlisting>
34+</section>