]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Always shutdown on test success in mkosi
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 5 May 2024 09:38:09 +0000 (11:38 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 May 2024 08:56:54 +0000 (10:56 +0200)
When we want to get an interactive shell in a test that fails because
of a race condition, we might need to run the test a few times with
--repeat before it fails. However, currently, when -i is used, the VM
needs to be shut down manually each time before the next run can start.

Let's always shut down the VM if the test succeeds so that --repeat can
be used with -i to run the test until it fails and then get an interactive
shell in the VM.

test/integration-test-wrapper.py

index 99ae43ac8314c09bc85d4a662d10c9a35d5a295b..a32210c06f1bc84bb50bf5639e8fe9d87afc1916 100755 (executable)
@@ -59,6 +59,8 @@ def main():
         [Unit]
         After=multi-user.target network.target
         Requires=multi-user.target
+        SuccessAction=exit
+        SuccessActionExitStatus=123
 
         [Service]
         StandardOutput=journal+console
@@ -85,8 +87,6 @@ def main():
         dropin += textwrap.dedent(
             """
             [Unit]
-            SuccessAction=exit
-            SuccessActionExitStatus=123
             FailureAction=exit
             """
         )
@@ -143,7 +143,7 @@ def main():
 
     result = subprocess.run(cmd)
     # Return code 123 is the expected success code
-    if result.returncode != (0 if sys.stderr.isatty() else 123):
+    if result.returncode != 123:
         if result.returncode != 77 and journal_file:
             cmd = [
                 'journalctl',