summary refs log tree commit diff
path: root/nixos/lib/test-driver
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2023-05-25 02:24:56 +0200
committerRaito Bezarius <masterancpp@gmail.com>2023-06-16 19:43:40 +0200
commit7088e386ff9eb2be501290354cc31faa9c0d6fbb (patch)
tree75451782aa5aafc8065b941851bb48417fcf514e /nixos/lib/test-driver
parent85c8cc7ce9eab9cc407036c8764a34b4300a6134 (diff)
downloadnixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar.gz
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar.bz2
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar.lz
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar.xz
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.tar.zst
nixpkgs-7088e386ff9eb2be501290354cc31faa9c0d6fbb.zip
nixosTests.kexec: reconnect properly after 2nd kexec
By some miracle, before, it was possible to reconnect to the `node1` without
doing any relevant dance.

But now we are direct booting (¿), it seems like we need to do the right things.

This introduces a `check_output` flag for `execute` because we do not want to steal the
messages from the backdoor service as we might execute the kexec too fast compared
to when we will reconnect.

Therefore, we will let the message in the pipe if needed.
Diffstat (limited to 'nixos/lib/test-driver')
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py
index 81d3e19084e..7ef0ae89910 100644
--- a/nixos/lib/test-driver/test_driver/machine.py
+++ b/nixos/lib/test-driver/test_driver/machine.py
@@ -514,7 +514,11 @@ class Machine:
         return "".join(output_buffer)
 
     def execute(
-        self, command: str, check_return: bool = True, timeout: Optional[int] = 900
+        self,
+        command: str,
+        check_return: bool = True,
+        check_output: bool = True,
+        timeout: Optional[int] = 900,
     ) -> Tuple[int, str]:
         self.run_callbacks()
         self.connect()
@@ -535,6 +539,9 @@ class Machine:
         assert self.shell
         self.shell.send(out_command.encode())
 
+        if not check_output:
+            return (-2, "")
+
         # Get the output
         output = base64.b64decode(self._next_newline_closed_block_from_shell())