From 27d7f883b941c6e796dc21abf1328bb70b7fcc65 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 2 Sep 2025 08:34:26 +0900 Subject: [PATCH] TEST-45-TIMEDATE: rotate journal before parsing log message Similar to 04ade57a4233750f45fbc5fa2b5f52adfb435de5. Fixes the following failure (long line is wrapped): ``` TEST-45-TIMEDATE.sh[234]: + journalctl --sync TEST-45-TIMEDATE.sh[234]: + for _ in {0..9} TEST-45-TIMEDATE.sh[234]: + journalctl -q -n 1 '--since=2025-09-01 17:09:25.442936' -p info -t busctl --grep . TEST-45-TIMEDATE.sh[363]: Sep 01 17:09:25 H busctl[351]: {"type":"signal","endian":"l","flags":1,"version":1, "cookie":67,"timestamp-realtime":1756746565578529,"sender":":1.11","path":"/org/freedesktop/timedate1", "interface":"org.freedesktop.DBus.Properties","member":"PropertiesChanged","payload":{"type":"sa{sv}as", "data":["org.freedesktop.timedate1",{"NTP":{"type":"b","data":false}},[]]}} TEST-45-TIMEDATE.sh[366]: ++ journalctl -q -n 1 '--since=2025-09-01 17:09:25.442936' -p info -t busctl -o cat TEST-45-TIMEDATE.sh[367]: ++ jq -r '.payload.data[1].NTP.data' TEST-45-TIMEDATE.sh[366]: Journal file /run/log/journal/07946b7846564ac0ad1c86e8cabed329/system.journal is truncated, ignoring file. TEST-45-TIMEDATE.sh[234]: + [[ '' == \f\a\l\s\e ]] ``` (cherry picked from commit cbbed2bd4410fda51f11eb1cb6155eda40e2fa8c) --- test/units/TEST-45-TIMEDATE.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/units/TEST-45-TIMEDATE.sh b/test/units/TEST-45-TIMEDATE.sh index 420ebefd017..b3554d0b84e 100755 --- a/test/units/TEST-45-TIMEDATE.sh +++ b/test/units/TEST-45-TIMEDATE.sh @@ -224,6 +224,9 @@ assert_timedated_signal() { for _ in {0..9}; do if journalctl "${args[@]}" --grep .; then + # Make the found entry in the archived journal, to avoid the following failure: + # Journal file /run/log/journal/.../system.journal is truncated, ignoring file. + journalctl --rotate [[ "$(journalctl "${args[@]}" -o cat | jq -r '.payload.data[1].NTP.data')" == "$value" ]]; return 0 fi @@ -304,6 +307,9 @@ assert_timesyncd_signal() { for _ in {0..9}; do if journalctl "${args[@]}" --grep .; then + # Make the found entry in the archived journal, to avoid the following failure: + # Journal file /run/log/journal/.../system.journal is truncated, ignoring file. + journalctl --rotate [[ "$(journalctl "${args[@]}" -o cat | jq -r ".payload.data[1].$property.data | join(\" \")")" == "$value" ]]; return 0 fi -- 2.47.3