about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorDomen Kožar2021-06-03 11:46:01 +0200
committerGitHub2021-06-03 11:46:01 +0200
commitf88be6e55cd634cd15d9c6165d2e93286017bc60 (patch)
tree18f500c23d7d54b08e0f6b437505a52a91aebb5b /nixos/lib
parentaeb44a891ae46e31e315af86e2c85c9412c3fdac (diff)
parentfd739c4dee12fbe57199f73c44ec22db2355028e (diff)
Merge pull request #125372 from Synthetica9/shell_interact
nixos/tests/test-driver: add shell_interact
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test-driver.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 6bbca95a97f6..e0e8b0fb71f4 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -21,6 +21,7 @@ import shutil
 import socket
 import subprocess
 import sys
+import telnetlib
 import tempfile
 import time
 import traceback
@@ -455,6 +456,16 @@ class Machine:
                 return (status_code, output)
             output += chunk
 
+    def shell_interact(self) -> None:
+        """Allows you to interact with the guest shell
+
+        Should only be used during test development, not in the production test."""
+        self.connect()
+        self.log("Terminal is ready (there is no prompt):")
+        telnet = telnetlib.Telnet()
+        telnet.sock = self.shell  # type: ignore
+        telnet.interact()
+
     def succeed(self, *commands: str) -> str:
         """Execute each command and check that it succeeds."""
         output = ""