!RROtHmAaQIkiJzJZZE:nixos.org

NixOS.org Infrastructure

68 Members
25 Servers

Load older messages


SenderMessageTime
22 Oct 2021
@k900:0upti.meK900So I left it looping overnight 05:52:47
@k900:0upti.meK900On a setup where qemu doesn't crash 05:52:54
@k900:0upti.meK900And not a single lockup05:52:58
@k900:0upti.meK900At this point I'm starting to wonder if there's something really weird about the environment on Hydra05:53:30
@janne.hess:helsinki-systems.deJanne 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:0upti.meK900
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.hess:helsinki-systems.deJanne Heßoh, right10:02:58
@k900:0upti.meK900You might want to remove the debug prints10:04:14
@k900:0upti.meK900I don't have a copy of nixpkgs on hand to PR :(10:04:21
@janne.hess:helsinki-systems.deJanne HeßI'd have to remember how to configure the jobset first…10:04:45
@janne.hess:helsinki-systems.deJanne Heßimage.png
Download image.png
10:45:37
@janne.hess:helsinki-systems.deJanne Heßall tests that we are builing work10:45:40
@k900:0upti.meK900That is a good sign10:45:52
@janne.hess:helsinki-systems.deJanne HeßYeah your change seems to be good to go10:46:17
@k900:0upti.meK900Can you run it a few more times?10:46:30
@janne.hess:helsinki-systems.deJanne HeßI don't think so, no10:46:48
@janne.hess:helsinki-systems.deJanne Heßit will always see that the builds are already done10:47:11
@janne.hess:helsinki-systems.deJanne HeßWe could try to get the change to master, it only seems to improve things10:57:08
@janne.hess:helsinki-systems.deJanne Heß(which isn't too hard since it won't get any worse than the channel being blocked)11:00:57
@k900:0upti.meK900 Janne Heß: can you PR it? 11:01:45
@janne.hess:helsinki-systems.deJanne HeßI can11:01:57
@k900:0upti.meK900I need a few hours to get to my personal machine11:02:19
@k900:0upti.meK900The one that has a copy of nixpkgs on it11:02:22
@janne.hess:helsinki-systems.deJanne HeßHere you go: https://github.com/NixOS/nixpkgs/pull/14256011:05:46
@k900:0upti.meK900Added a comment11:08:00
@k900:0upti.meK900Thanks!11:08:04
@k900:0upti.meK900 Janne Heß any idea why it's stuck on ofborg/aarch64? 14:48:09
@k900:0upti.meK900I got home finally so I can continue hacking 14:48:23
@janne.hess:helsinki-systems.deJanne HeßThe queue is quite busy, nothing out of the ordinary 14:48:37
@k900:0upti.meK900OK cool 15:02:14

There are no newer messages yet.


Back to Room List