summary refs log tree commit diff
path: root/nixos/doc/manual/development/debugging-nixos-tests.xml
blob: 30e58e1e3554c2ffd386fed6a88b740a1895639f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<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-debugging-nixos-tests">
 <title>Debugging NixOS tests</title>

 <para>
  Tests may fail and infrastructure offers access to inspect machine state.
 </para>

 <para>
  To prevent test from stopping and cleaning up, insert a sleep command:
 </para>

<programlisting>
$machine->succeed("sleep 84000");
</programlisting>

 <para>
  As soon as machine starts run as root:
 </para>

<programlisting>
nix-shell -p socat --run "socat STDIO,raw,echo=0,escape=0x11 UNIX:/tmp/nix-build-vm-test-run-*.drv-0/vm-state-machine/backdoor"
</programlisting>

 <para>
  You may need to find the correct path, replacing <literal>/tmp</literal>,
  <literal>*</literal> or <literal>machine</literal>.
 </para>

 <para>
  Press "enter" to open up console and login as "root". After you're done,
  press "ctrl-q" to exit the console.
 </para>
</section>