From: Luca Boccassi Date: Fri, 7 Nov 2025 20:12:47 +0000 (+0000) Subject: test: rotate journal before invocation test X-Git-Tag: v259-rc1~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2db3e403ae084616dbb1e38793ec224587c1f3c6;p=thirdparty%2Fsystemd.git test: rotate journal before invocation test Occasionally there are truncated journals failing this test: [ 884.181701] H TEST-04-JOURNAL.sh[12104]: ++ journalctl --no-hostname -n 1 -t bash --invocation=fe8122a7d8eb42c7bf357ac5fafa95e1 [ 884.181749] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1' 'Nov 06 17:27:10 bash[11985]: invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1' [ 884.181773] H TEST-04-JOURNAL.sh[12105]: + set +ex [ 884.181819] H TEST-04-JOURNAL.sh[12091]: + read -r idx invocation _ [ 884.181819] H TEST-04-JOURNAL.sh[12091]: + i=2 [ 884.181865] H TEST-04-JOURNAL.sh[12106]: ++ journalctl --no-hostname -n 1 -t bash --invocation=2 -u invocation-id-test-20992 [ 884.181865] H TEST-04-JOURNAL.sh[12106]: Journal file /var/log/journal/936183a66e7c47939693ae37a967e4fd/system.journal is truncated, ignoring file. [ 884.181865] H TEST-04-JOURNAL.sh[12106]: No journal entry found for the invocation (+2). [ 884.181952] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 2 07d0bd6b5c654b148541d798abccaa96' '' [ 884.181972] H TEST-04-JOURNAL.sh[12107]: + set +ex [ 884.181972] H TEST-04-JOURNAL.sh[12107]: FAIL: 'invocation 2 07d0bd6b5c654b148541d798abccaa96' not found in: Rotate it at the beginning of the test case to try and avoid this. Fixes https://github.com/systemd/systemd/issues/39601 --- diff --git a/test/units/TEST-04-JOURNAL.invocation.sh b/test/units/TEST-04-JOURNAL.invocation.sh index 74db1040fdf..39ac26131c0 100755 --- a/test/units/TEST-04-JOURNAL.invocation.sh +++ b/test/units/TEST-04-JOURNAL.invocation.sh @@ -18,6 +18,7 @@ TMP_DIR=$(mktemp -d) # service stdout will not contain _SYSTEMD_INVOCATION_ID field. SAVED_LOG_LEVEL=$(systemctl log-level) systemctl log-level info +journalctl --rotate # Note, if the service exits extremely fast, journald cannot find the source of the # stream. Hence, we need to call 'journalctl --sync' before service exits.