| 22 Oct 2021 |
K900 | At this point I'm starting to wonder if there's something really weird about the environment on Hydra | 05:53:30 |
Janne Heß | In reply to @k900:0upti.me On a setup where qemu doesn't crash Can you PR your changes? I can try to apply it to our Hydra and see if the tests work again | 10:02:36 |
K900 | In reply to @k900:0upti.me
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 3ee8b3227c6..48831f53188 100755
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -8,7 +8,6 @@ import queue
import io
import threading
import argparse
-import atexit
import base64
import codecs
import os
@@ -583,24 +582,37 @@ class Machine:
)
def execute(self, command: str) -> Tuple[int, str]:
+ status_code_magic = "|!=EOF"
+ status_code_magic_bytes = status_code_magic.encode()
+
self.connect()
- out_command = "( set -euo pipefail; {} ); echo '|!=EOF' $?\n".format(command)
+ out_command = (
+ f"( set -euo pipefail; {command} ); echo '{status_code_magic}' $?\n"
+ )
assert self.shell
self.shell.send(out_command.encode())
- output = ""
- status_code_pattern = re.compile(r"(.*)\|\!=EOF\s+(\d+)")
+ output = b""
while True:
- chunk = self.shell.recv(4096).decode(errors="ignore")
- match = status_code_pattern.match(chunk)
- if match:
- output += match[1]
- status_code = int(match[2])
- return (status_code, output)
+ chunk = self.shell.recv(4096)
output += chunk
+ if not chunk:
+ return (-255, output.decode())
+
+ print("current output is")
+ print(output.decode())
+
+ if status_code_magic_bytes in output:
+ output, status_code_b = output.rsplit(
+ status_code_magic_bytes, maxsplit=1
+ )
+ status_code = int(status_code_b.strip())
+ print("got status code", status_code)
+ return (status_code, output.decode())
+
def shell_interact(self) -> None:
"""Allows you to interact with the guest shell
@@ -1034,7 +1046,7 @@ class Machine:
assert self.monitor
assert self.serial_thread
- self.process.terminate()
+ self.process.kill()
self.shell.close()
self.monitor.close()
self.serial_thread.join()
@@ -1128,11 +1140,13 @@ class Driver:
for cmd in cmd(start_scripts)
]
- @atexit.register
- def clean_up() -> None:
- with rootlog.nested("clean up"):
- for machine in self.machines:
- machine.release()
+ def __enter__(self) -> "Driver":
+ return self
+
+ def __exit__(self, *_: Any) -> None:
+ with rootlog.nested("clean up"):
+ for machine in self.machines:
+ machine.release()
def subtest(self, name: str) -> Iterator[None]:
"""Group logs under a given test name"""
@@ -1307,14 +1321,13 @@ if __name__ == "__main__":
if not args.keep_vm_state:
rootlog.info("Machine state will be reset. To keep it, pass --keep-vm-state")
- driver = Driver(
+ with Driver(
args.start_scripts, args.vlans, args.testscript.read_text(), args.keep_vm_state
- )
-
- if args.interactive:
- ptpython.repl.embed(driver.test_symbols(), {})
- else:
- tic = time.time()
- driver.run_tests()
- toc = time.time()
- rootlog.info(f"test script finished in {(toc-tic):.2f}s")
+ ) as driver:
+ if args.interactive:
+ ptpython.repl.embed(driver.test_symbols(), {})
+ else:
+ tic = time.time()
+ driver.run_tests()
+ toc = time.time()
+ rootlog.info(f"test script finished in {(toc-tic):.2f}s")
It's this | 10:02:49 |
Janne Heß | oh, right | 10:02:58 |
K900 | You might want to remove the debug prints | 10:04:14 |
K900 | I don't have a copy of nixpkgs on hand to PR :( | 10:04:21 |
Janne Heß | I'd have to remember how to configure the jobset first… | 10:04:45 |
Janne Heß |  Download image.png | 10:45:37 |
Janne Heß | all tests that we are builing work | 10:45:40 |
K900 | That is a good sign | 10:45:52 |
Janne Heß | Yeah your change seems to be good to go | 10:46:17 |
K900 | Can you run it a few more times? | 10:46:30 |
Janne Heß | I don't think so, no | 10:46:48 |
Janne Heß | it will always see that the builds are already done | 10:47:11 |
Janne Heß | We could try to get the change to master, it only seems to improve things | 10:57:08 |
Janne Heß | (which isn't too hard since it won't get any worse than the channel being blocked) | 11:00:57 |
K900 | Janne Heß: can you PR it? | 11:01:45 |
Janne Heß | I can | 11:01:57 |
K900 | I need a few hours to get to my personal machine | 11:02:19 |
K900 | The one that has a copy of nixpkgs on it | 11:02:22 |
Janne Heß | Here you go: https://github.com/NixOS/nixpkgs/pull/142560 | 11:05:46 |
K900 | Added a comment | 11:08:00 |
K900 | Thanks! | 11:08:04 |
K900 | Janne Heß any idea why it's stuck on ofborg/aarch64? | 14:48:09 |
K900 | I got home finally so I can continue hacking | 14:48:23 |
Janne Heß | The queue is quite busy, nothing out of the ordinary | 14:48:37 |
K900 | OK cool | 15:02:14 |
| 23 Oct 2021 |
K900 | In reply to @janne.hess:helsinki-systems.de Here you go: https://github.com/NixOS/nixpkgs/pull/142560 Ofborg is still stuck on that | 16:38:15 |
K900 | Maybe we should just merge? | 16:38:24 |
K900 | We know x86-64 passes on ofborg | 16:38:33 |