about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorAstro <astro@spaceboyz.net>2023-03-15 02:24:25 +0100
committerAstro <astro@spaceboyz.net>2023-03-15 12:48:01 +0100
commit95d121e7983cabe9977779af948ccd46cb4845a6 (patch)
treec4c1a1b5b52565b5f9302f6207ceac9f2218f2c7 /nixos/lib
parent5a1dc8acd977ff3dccd1328b7c4a6995429a656b (diff)
downloadnixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar.gz
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar.bz2
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar.lz
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar.xz
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.tar.zst
nixlib-95d121e7983cabe9977779af948ccd46cb4845a6.zip
nixos/test-driver: fix allow_reboot
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py
index 0db7930f496b..a4f7a555f818 100644
--- a/nixos/lib/test-driver/test_driver/machine.py
+++ b/nixos/lib/test-driver/test_driver/machine.py
@@ -144,7 +144,7 @@ class StartCommand:
         self,
         monitor_socket_path: Path,
         shell_socket_path: Path,
-        allow_reboot: bool = False,  # TODO: unused, legacy?
+        allow_reboot: bool = False,
     ) -> str:
         display_opts = ""
         display_available = any(x in os.environ for x in ["DISPLAY", "WAYLAND_DISPLAY"])
@@ -152,16 +152,14 @@ class StartCommand:
             display_opts += " -nographic"
 
         # qemu options
-        qemu_opts = ""
-        qemu_opts += (
-            ""
-            if allow_reboot
-            else " -no-reboot"
+        qemu_opts = (
             " -device virtio-serial"
             " -device virtconsole,chardev=shell"
             " -device virtio-rng-pci"
             " -serial stdio"
         )
+        if not allow_reboot:
+            qemu_opts += " -no-reboot"
         # TODO: qemu script already catpures this env variable, legacy?
         qemu_opts += " " + os.environ.get("QEMU_OPTS", "")
 
@@ -195,9 +193,10 @@ class StartCommand:
         shared_dir: Path,
         monitor_socket_path: Path,
         shell_socket_path: Path,
+        allow_reboot: bool,
     ) -> subprocess.Popen:
         return subprocess.Popen(
-            self.cmd(monitor_socket_path, shell_socket_path),
+            self.cmd(monitor_socket_path, shell_socket_path, allow_reboot),
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT,
@@ -898,6 +897,7 @@ class Machine:
             self.shared_dir,
             self.monitor_path,
             self.shell_path,
+            self.allow_reboot,
         )
         self.monitor, _ = monitor_socket.accept()
         self.shell, _ = shell_socket.accept()