From 01f79dfc9e2e132479ff053ed79ead82731327b7 Mon Sep 17 00:00:00 2001 From: Marijan Date: Wed, 6 Nov 2019 22:40:02 +0100 Subject: [PATCH 1/2] nixos/tests: implemented python test-driver version of dumpTTYContents --- nixos/lib/test-driver/test-driver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index c6baf75003a..bc2c719295c 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -494,6 +494,11 @@ class Machine: if ret.returncode != 0: raise Exception("Cannot convert screenshot") + def dump_tty_contents(self, tty): + """Debugging: Dump the contents of the TTY + """ + self.execute("fold -w 80 /dev/vcs{} | systemd-cat".format(tty)) + def get_screen_text(self): if shutil.which("tesseract") is None: raise Exception("get_screen_text used but enableOCR is false") From 9915a8ca45ff0867739d2cefe0be622d8c817368 Mon Sep 17 00:00:00 2001 From: Marijan Date: Wed, 6 Nov 2019 22:41:03 +0100 Subject: [PATCH 2/2] nixos/tests: implemented python test-driver version of forwardPort --- nixos/lib/test-driver/test-driver.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index bc2c719295c..3992250221d 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -650,6 +650,14 @@ class Machine: def sleep(self, secs): time.sleep(secs) + def forward_port(self, host_port=8080, guest_port=80): + """Forward a TCP port on the host to a TCP port on the guest. + Useful during interactive testing. + """ + self.send_monitor_command( + "hostfwd_add tcp::{}-:{}".format(host_port, guest_port) + ) + def block(self): """Make the machine unreachable by shutting down eth1 (the multicast interface used to talk to the other VMs). We keep eth0 up so that