From f472e52aa6a718090f433f60b2f6c6748b981d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 12 Jan 2022 21:34:01 +0100 Subject: [PATCH] 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 --- nixos/lib/test-driver/test_driver/machine.py | 4 ++-- 1 file 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 e050cbd7d990..09d95f7a1ae7 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()], )