···436 </para>
437 </listitem>
438 </varlistentry>
439+ <varlistentry>
440+ <term>
441+ <methodname>shell_interact</methodname>
442+ </term>
443+ <listitem>
444+ <para>
445+ Allows you to directly interact with the guest shell.
446+ This should only be used during test development, not in production tests.
447+ Killing the interactive session with <literal>Ctrl-d</literal> or <literal>Ctrl-c</literal> also ends the guest session.
448+ </para>
449+ </listitem>
450+ </varlistentry>
451 </variablelist>
452 </para>
453
+11
nixos/lib/test-driver/test-driver.py
···21import socket
22import subprocess
23import sys
024import tempfile
25import time
26import traceback
···454 status_code = int(match[2])
455 return (status_code, output)
456 output += chunk
0000000000457458 def succeed(self, *commands: str) -> str:
459 """Execute each command and check that it succeeds."""
···21import socket
22import subprocess
23import sys
24+import telnetlib
25import tempfile
26import time
27import traceback
···455 status_code = int(match[2])
456 return (status_code, output)
457 output += chunk
458+459+ def shell_interact(self) -> None:
460+ """Allows you to interact with the guest shell
461+462+ Should only be used during test development, not in the production test."""
463+ self.connect()
464+ self.log("Terminal is ready (there is no prompt):")
465+ telnet = telnetlib.Telnet()
466+ telnet.sock = self.shell # type: ignore
467+ telnet.interact()
468469 def succeed(self, *commands: str) -> str:
470 """Execute each command and check that it succeeds."""