mirror of
https://github.com/systemd/systemd.git
synced 2025-03-08 08:58:27 +03:00
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.
This commit is contained in:
parent
0596237e0e
commit
d91bb1cbf0
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user