]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: make TEST-04 stable once again
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 1 Jun 2023 07:07:28 +0000 (09:07 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 1 Jun 2023 12:11:21 +0000 (21:11 +0900)
Wait a bit if necessary for the cursor file to appear.

Follow-up fb35feae97.

test/units/testsuite-04.sh

index 4af619941bc22e30290035d4ca3437634a74ce29..a2070704927ce4c36cc68f71fb8156aed7d545d2 100755 (executable)
@@ -163,15 +163,15 @@ set -o pipefail
 
 # https://github.com/systemd/systemd/issues/26746
 rm -f /tmp/issue-26746-log /tmp/issue-26746-cursor
-ID=$(systemd-id128 new)
+ID="$(systemd-id128 new)"
 journalctl -t "$ID" --follow --cursor-file=/tmp/issue-26746-cursor | tee /tmp/issue-26746-log &
 systemd-cat -t "$ID" /bin/sh -c 'echo hogehoge'
 # shellcheck disable=SC2016
 timeout 10 bash -c 'while ! [[ -f /tmp/issue-26746-log && "$(cat /tmp/issue-26746-log)" =~ hogehoge ]]; do sleep .5; done'
 pkill -TERM journalctl
-test -f /tmp/issue-26746-cursor
-CURSOR_FROM_FILE=$(cat /tmp/issue-26746-cursor)
-CURSOR_FROM_JOURNAL=$(journalctl -t "$ID" --output export MESSAGE=hogehoge | sed -n -e '/__CURSOR=/ { s/__CURSOR=//; p }')
+timeout 10 bash -c 'while ! test -f /tmp/issue-26746-cursor; do sleep .5; done'
+CURSOR_FROM_FILE="$(cat /tmp/issue-26746-cursor)"
+CURSOR_FROM_JOURNAL="$(journalctl -t "$ID" --output=export MESSAGE=hogehoge | sed -n -e '/__CURSOR=/ { s/__CURSOR=//; p }')"
 test "$CURSOR_FROM_FILE" = "$CURSOR_FROM_JOURNAL"
 
 add_logs_filtering_override() {