A few test fixes (#40524)

These are some patches we currently have in Ubuntu for the development
release. A couple are related to Ubuntu switching to uutils coreutils by
default.
This commit is contained in:
Yu Watanabe
2026-01-31 01:19:38 +09:00
committed by GitHub
5 changed files with 10 additions and 9 deletions
+4 -4
View File
@@ -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
@@ -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"
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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"
+1
View File
@@ -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"
)