From: Nick Rosbrook Date: Mon, 19 Jan 2026 21:09:12 +0000 (-0500) Subject: test: use journalctl -n option instead of piping to head X-Git-Tag: v257.11~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10ba7735a57a7f4264e515900be3fefb2240c809;p=thirdparty%2Fsystemd.git 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. (cherry picked from commit a8efad14f878a5ea0d566fd61bda8e0bb332ae7d) (cherry picked from commit 2c661e5f0d54c59a796423c1b8c785ce94dcc026) (cherry picked from commit ab3e570ede7c5e41b2e2cb664e2c1e1ea6cfe4c8) --- diff --git a/test/units/TEST-04-JOURNAL.journal.sh b/test/units/TEST-04-JOURNAL.journal.sh index 06b49793748..40ec7abc192 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 -q -v TAIL 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