diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2021-06-22 08:51:39 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2021-06-22 09:08:57 +0200 |
commit | 48aec70ea13aaf16d0f58e7525823cc3820cdc40 (patch) | |
tree | d2ef31b0b552c71b145c579d18c37af7181d3503 | |
parent | a95eebd1cd1e06b7862ac1a99d9054eab94b97f7 (diff) |
nixos/test-driver: replace termlib with socat
telnetlib does not handle unicode, which is annoying when using systemctl.
Also this gives us a nice readline with history.
-rw-r--r-- | nixos/lib/test-driver/test-driver.py | 7 | ||||
-rw-r--r-- | nixos/lib/testing-python.nix | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index 5be741395a08..7f4dd5963c92 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -462,9 +462,10 @@ 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):") - telnet = telnetlib.Telnet() - telnet.sock = self.shell # type: ignore - telnet.interact() + subprocess.run( + ["socat", "READLINE", f"FD:{self.shell.fileno()}"], + pass_fds=[self.shell.fileno()], + ) def succeed(self, *commands: str) -> str: """Execute each command and check that it succeeds.""" diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index dbff6b98f0d6..768f1dc2a170 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -64,7 +64,7 @@ rec { wrapProgram $out/bin/nixos-test-driver \ --argv0 ${name} \ - --prefix PATH : "${lib.makeBinPath [ qemu_pkg vde2 netpbm coreutils ]}" \ + --prefix PATH : "${lib.makeBinPath [ qemu_pkg vde2 netpbm coreutils socat ]}" \ ${lib.optionalString enableOCR "--prefix PATH : '${ocrProg}/bin:${imagemagick_tiff}/bin'"} \ |