From d91bb1cbf073f2777cd3eebd8ff39c58066bd5c1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 5 May 2024 11:38:09 +0200 Subject: [PATCH] test: Always shutdown on test success in mkosi 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 99ae43ac831..a32210c06f1 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -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',