summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-01-12 21:34:01 +0100
committerJörg Thalheim <joerg@thalheim.io>2022-01-15 07:07:06 +0100
commitf472e52aa6a718090f433f60b2f6c6748b981d6e (patch)
tree119962f72f20e9b0be85a44bc7eebf37c8af9242 /nixos/lib
parent4b46a593ef0a6b546f2c32b9be838c7aa6c4e97e (diff)
downloadnixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar.gz
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar.bz2
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar.lz
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar.xz
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.tar.zst
nixpkgs-f472e52aa6a718090f433f60b2f6c6748b981d6e.zip
nixos/tests: add prompt to shell_interact()
Example session:

>>> start_all()
>>> machines[0].shell_interact()
client: waiting for the VM to finish booting
client: connected to guest root shell
client: (connecting took 0.00 seconds)
(finished: waiting for the VM to finish booting, in 0.05 seconds)
client: Terminal is ready (there is no initial prompt):
$ ls -la
total 39
drwxrwxrwt 11 root root 4096 Jan 15 06:06 .
drwxr-xr-x 17 root root 4096 Jan 15 06:06 ..
drwxrwxrwt  2 root root 4096 Jan 15 06:06 .font-unix
drwxrwxrwt  2 root root 4096 Jan 15 06:06 .ICE-unix
drwx------  2 root root    2 Jan 12 20:19 shared
drwx------  3 root root 4096 Jan 15 06:06 systemd-private-b8f21699ea684491926859758de41975-nscd.service-txgYVZ
drwx------  3 root root 4096 Jan 15 06:06 systemd-private-b8f21699ea684491926859758de41975-systemd-logind.service-U3GmlL
drwxrwxrwt  2 root root 4096 Jan 15 06:06 .Test-unix
drwxrwxrwt  2 root root 4096 Jan 15 06:06 .X11-unix
drwxr-xr-x  2 root root    2 Jan 15 06:06 xchg
drwxrwxrwt  2 root root 4096 Jan 15 06:06 .XIM-unix
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py
index e050cbd7d99..09d95f7a1ae 100644
--- a/nixos/lib/test-driver/test_driver/machine.py
+++ b/nixos/lib/test-driver/test_driver/machine.py
@@ -540,11 +540,11 @@ class Machine:
 
         Should only be used during test development, not in the production test."""
         self.connect()
-        self.log("Terminal is ready (there is no prompt):")
+        self.log("Terminal is ready (there is no initial prompt):")
 
         assert self.shell
         subprocess.run(
-            ["socat", "READLINE", f"FD:{self.shell.fileno()}"],
+            ["socat", "READLINE,prompt=$ ", f"FD:{self.shell.fileno()}"],
             pass_fds=[self.shell.fileno()],
         )