!RROtHmAaQIkiJzJZZE:nixos.org

NixOS.org Infrastructure

82 Members
See #infra-alerts:nixos.org for real time alerts from Prometheus.28 Servers

Load older messages


SenderMessageTime
21 Oct 2021
@k900:0upti.meK900Let me try switch-test20:11:18
@k900:0upti.meK900Took two minutes but it did pass20:13:48
@k900:0upti.meK900Gonna loop it now20:14:02
@janne.hess:helsinki-systems.deJanne Heßoof20:14:10
@k900:0upti.meK900 This box might not have KVM 20:14:23
@k900:0upti.meK900I'm pretty sure it does20:14:26
@k900:0upti.meK900But it might just be brute forcing20:14:38
@k900:0upti.meK900OK it does have KVM20:15:04
@k900:0upti.meK900OK I broke it20:15:45
@k900:0upti.meK900It's looping on "current output is ''" now20:15:54
@janne.hess:helsinki-systems.deJanne Heßyup, that's what I initially wanted to debug20:16:03
@janne.hess:helsinki-systems.deJanne Heßsee here: https://github.com/NixOS/nixpkgs/pull/142498#issuecomment-94891835320:16:11
@k900:0upti.meK900Oh no20:19:00
@k900:0upti.meK900I tried to make it use bytes and now everything is broken20:20:14
@k900:0upti.meK900OK I got it to pass again with your changes + my changes + some bytes fuckery20:28:05
@janne.hess:helsinki-systems.deJanne Heßnoice20:28:12
@k900:0upti.meK900Now to see if it's consistent20:28:15
@janne.hess:helsinki-systems.deJanne Heßin a loop?20:28:16
@janne.hess:helsinki-systems.deJanne Heßgreat20:28:21
@k900:0upti.meK900Once, for now20:28:21
@k900:0upti.meK900Great20:30:06
@k900:0upti.meK900QEMU segfaults now20:30:10
@k900:0upti.meK900WHAT20:30:11
@k900:0upti.meK900OK, I think I'm done for tonight20:42:55
@k900:0upti.meK900I'm literally falling asleep here20:42:59
@k900:0upti.meK900
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")

20:43:02
@k900:0upti.meK900Here's what I got so far20:43:04
@k900:0upti.meK900But it really seems like it's not designed to handle QEMU just dying randomly20:43:17
@tomberek:matrix.orgtomberekIs there a possibility/benefit to scale-out our builders during ZHF in preparation for a release? And then scale-in during the "off season"?21:53:32
@vcunat:matrix.orgVladimír ČunátI think the ability is there.22:01:24

Show newer messages


Back to Room ListRoom Version: 6