]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
integration-test: show journalctl command for showing saved journal when TEST_SAVE_JO...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 24 Jul 2025 17:46:07 +0000 (02:46 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 4 Aug 2025 14:58:53 +0000 (15:58 +0100)
(cherry picked from commit 82693960784427ad8583e6a7570c2f4834a6d397)

test/integration-tests/integration-test-wrapper.py

index 611dffbf53474e545511534d4122a4fdad5ed9cf..c5d7b55dd683d369e9154bf10a8a80a455c1601b 100755 (executable)
@@ -634,7 +634,12 @@ def main() -> None:
         journal_file = shutil.move(journal_file, dst)
 
     if shell or (result.returncode in (args.exit_code, 77) and not coredumps and not sanitizer):
-        exit(0 if shell or result.returncode == args.exit_code else 77)
+        exit_code = 0 if shell or result.returncode == args.exit_code else 77
+        exit_str = 'succeeded' if exit_code == 0 else 'skipped'
+    else:
+        # 0 also means we failed so translate that to a non-zero exit code to mark the test as failed.
+        exit_code = result.returncode or 1
+        exit_str = 'failed'
 
     if journal_file.exists():
         ops = []
@@ -649,10 +654,11 @@ def main() -> None:
 
         ops += [f'journalctl --file {journal_file} --no-hostname -o short-monotonic -u {args.unit} -p info']
 
-        print(f'Test failed, relevant logs can be viewed with: \n\n{(" && ".join(ops))}\n', file=sys.stderr)
+        print(
+            f'Test {exit_str}, relevant logs can be viewed with: \n\n{(" && ".join(ops))}\n', file=sys.stderr
+        )
 
-    # 0 also means we failed so translate that to a non-zero exit code to mark the test as failed.
-    exit(result.returncode or 1)
+    exit(exit_code)
 
 
 if __name__ == '__main__':