From ed935fdf97cb6ec6fd60eea27ec0231ce81b1a3c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 20 Mar 2024 06:22:17 +0900 Subject: [PATCH] test: add test case for issue #31776 (cherry picked from commit bf995423fd6a1614916036d678b2c49385712cb7) Related: RHEL-30567 --- test/units/testsuite-04.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh index 71a6137cf2..bc81a18122 100755 --- a/test/units/testsuite-04.sh +++ b/test/units/testsuite-04.sh @@ -254,4 +254,12 @@ world EOF rm -f "$CURSOR_FILE" +# Check that --until works with --after-cursor and --lines/-n +# See: https://github.com/systemd/systemd/issues/31776 +CURSOR_FILE="$(mktemp)" +journalctl -q -n 0 --cursor-file="$CURSOR_FILE" +TIMESTAMP="$(journalctl -q -n 1 --cursor="$(<"$CURSOR_FILE")" --output=short-unix | cut -d ' ' -f 1 | cut -d '.' -f 1)" +[[ -z "$(journalctl -q -n 10 --after-cursor="$(<"$CURSOR_FILE")" --until "@$((TIMESTAMP - 3))")" ]] +rm -f "$CURSOR_FILE" + touch /testok