]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
machine: Fail test more gracefully if the image fails to boot 982/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 19 Apr 2022 19:15:41 +0000 (21:15 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 19 May 2022 09:08:16 +0000 (11:08 +0200)
mkosi/machine.py

index e8519c902dba5afb742a6a6a3fb5c2f23e7c7ceb..e572b868a29a422f4006507078666102d7d1549c 100644 (file)
@@ -212,7 +212,13 @@ class MkosiMachineTest(unittest.TestCase):
         # Necessary for shell otherwise racing conditions to the disk image will happen.
         test_name = self.id().split(".")[3]
         self.machine.args.hostname = test_name.replace("_", "-")
-        self.machine.boot()
+
+        try:
+            self.machine.boot()
+        except pexpect.EOF:
+            self.fail(f'Failed to boot machine with command "{self.machine.serial.args}"')
+        except pexpect.TIMEOUT:
+            self.fail(f'Timed out while waiting for machine to boot with command "{self.machine.serial.args}"')
 
     def tearDown(self) -> None:
         self.machine.kill()