From a8efad14f878a5ea0d566fd61bda8e0bb332ae7d Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Mon, 19 Jan 2026 16:09:12 -0500 Subject: [PATCH 1/3] test: use journalctl -n option instead of piping to head On Ubuntu's test infrastructure for the development series, this test often fails when piping the journal output to head. The cause is unclear, but possibly related to Ubuntu's use of uutils coreutils. Workaround this by just using journalctl's -n flag, which removes the need for piping output to head. --- test/units/TEST-04-JOURNAL.journal.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/units/TEST-04-JOURNAL.journal.sh b/test/units/TEST-04-JOURNAL.journal.sh index de3b45eaee..03613b5805 100755 --- a/test/units/TEST-04-JOURNAL.journal.sh +++ b/test/units/TEST-04-JOURNAL.journal.sh @@ -69,12 +69,12 @@ journalctl -b -t "$ID" --truncate-newline | grep -v TAIL >/dev/null journalctl -b -1 -b all -m >/dev/null # -b always behaves like -b0 -journalctl -q -b-1 -b0 | head -1 >/tmp/expected -journalctl -q -b-1 -b | head -1 >/tmp/output +journalctl -q -b-1 -b0 -n+1 >/tmp/expected +journalctl -q -b-1 -b -n+1 >/tmp/output diff /tmp/expected /tmp/output # ... even when another option follows (both of these should fail due to -m) -{ journalctl -ball -b0 -m 2>&1 || :; } | head -1 >/tmp/expected -{ journalctl -ball -b -m 2>&1 || :; } | head -1 >/tmp/output +{ journalctl -ball -b0 -n+1 -m 2>&1 || :; } >/tmp/expected +{ journalctl -ball -b -n+1 -m 2>&1 || :; } >/tmp/output diff /tmp/expected /tmp/output # https://github.com/systemd/systemd/issues/13708 From 9dcfd6e8fe080f959c363e6d896848faeb1b8156 Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Mon, 19 Jan 2026 16:09:52 -0500 Subject: [PATCH 2/3] test: cope with uutils coreutils flag parsing for date command With GNU coreutils, one can pass an argument to the "set" flag like: date -s "-3 days" With uutils coreutils, that gives an error: error: unexpected argument '-3' found tip: to pass '-3' as a value, use '-- -3' That's a bug (https://github.com/uutils/coreutils/issues/9679), but both implementations accept --set="-3 days" just fine, so use that instead. --- test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh | 2 +- test/units/TEST-53-TIMER.issue-16347.sh | 4 ++-- test/units/TEST-53-TIMER.restart-trigger.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh b/test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh index e9b9d4feee..2baa47c028 100755 --- a/test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh +++ b/test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh @@ -84,7 +84,7 @@ check_elapse_timestamp # elapse timestamp (this goes through a slightly different codepath that actually contained the original # issue). : "Next elapse timestamp after time jump" -date -s "tomorrow 00:10" +date --set="tomorrow 00:10" check_elapse_timestamp : "Next elapse timestamp after daemon-reload" diff --git a/test/units/TEST-53-TIMER.issue-16347.sh b/test/units/TEST-53-TIMER.issue-16347.sh index 8b266145cd..b4867872da 100755 --- a/test/units/TEST-53-TIMER.issue-16347.sh +++ b/test/units/TEST-53-TIMER.issue-16347.sh @@ -4,8 +4,8 @@ set -eux set -o pipefail # Reset host date to current time, 3 days in the past. -date -s "-3 days" -trap 'date -s "+3 days"' EXIT +date --set="-3 days" +trap 'date --set="+3 days"' EXIT # Run a timer for every 15 minutes. systemd-run --unit test-timer --on-calendar "*:0/15:0" true diff --git a/test/units/TEST-53-TIMER.restart-trigger.sh b/test/units/TEST-53-TIMER.restart-trigger.sh index e5cd575d66..71de99cf27 100755 --- a/test/units/TEST-53-TIMER.restart-trigger.sh +++ b/test/units/TEST-53-TIMER.restart-trigger.sh @@ -37,8 +37,8 @@ JOURNAL_TS="$(date "+%s")" systemctl restart "$UNIT_NAME.timer" systemctl status "$UNIT_NAME.timer" -date -s '+2 hours' -trap 'date -s "-2 hours"' EXIT +date --set='+2 hours' +trap 'date --set="-2 hours"' EXIT sleep 1 systemctl status "$UNIT_NAME.timer" assert_eq "$(journalctl -q -p info --since="@$JOURNAL_TS" --unit="$UNIT_NAME" --grep="$TEST_MESSAGE" | wc -l)" "1" From 7c9c34514a705ea0ce61432503a05162d0f658b0 Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Fri, 30 Jan 2026 09:23:03 -0500 Subject: [PATCH 3/3] test: disable pipefail again in monitor_check_rr() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partially reverts d6b379370485b9651f86b628ce980de719299eb4. On Ubuntu 26.04 devel, TEST-75-RESOLVED often fails at this stage, despite the matching query apparently being found: + monitor_check_rr '2025-12-18 16:02:54' 'follow10.so.close.signed.test IN CNAME follow11.yet.so.far.signed.test' + set +x Dec 18 16:02:54 ns1.unsigned.test resolvectl[552]: ← A: follow10.so.close.signed.test IN CNAME follow11.yet.so.far.signed.test + monitor_check_rr '2025-12-18 16:02:54' 'follow11.yet.so.far.signed.test IN CNAME follow12.getting.hot.signed.test' + set +x Dec 18 16:02:54 ns1.unsigned.test resolvectl[552]: ← A: follow11.yet.so.far.signed.test IN CNAME follow12.getting.hot.signed.test + monitor_check_rr '2025-12-18 16:02:54' 'follow12.getting.hot.signed.test IN CNAME follow13.almost.final.signed.test' + set +x Dec 18 16:02:54 ns1.unsigned.test resolvectl[552]: ← A: follow12.getting.hot.signed.test IN CNAME follow13.almost.final.signed.test + monitor_check_rr '2025-12-18 16:02:54' 'follow13.almost.final.signed.test IN CNAME follow14.final.signed.test' + set +x Dec 18 16:02:54 ns1.unsigned.test resolvectl[552]: ← A: follow13.almost.final.signed.test IN CNAME follow14.final.signed.test Unsetting pipefail, as was done before d6b3793704, appears to fix the problem. --- test/units/TEST-75-RESOLVED.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/units/TEST-75-RESOLVED.sh b/test/units/TEST-75-RESOLVED.sh index 47b5fa6660..e6ef9214a3 100755 --- a/test/units/TEST-75-RESOLVED.sh +++ b/test/units/TEST-75-RESOLVED.sh @@ -60,6 +60,7 @@ monitor_check_rr() ( # displayed. We turn off pipefail for this, since we don't care about the # lhs of this pipe expression, we only care about the rhs' result to be # clean + set +o pipefail timeout -v 30s journalctl -u resolvectl-monitor.service --since "$since" -f --full | grep -m1 "$match" )