]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: replace `tail -f` with journal cursor which should be...
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 1 Jul 2019 07:27:59 +0000 (09:27 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 5 Aug 2019 13:05:26 +0000 (15:05 +0200)
more reliable

test/TEST-36-NUMAPOLICY/testsuite.sh

index e15087b137aa67ac29e195075cd7082341bb27bf..306a96b5170dba715c7b103b9fd90ab764331e00 100755 (executable)
@@ -29,6 +29,9 @@ testUnitNUMAConf="$testUnitFile.d/numa.conf"
 journalSleep=5
 sleepAfterStart=1
 
+# Journal cursor for easier navigation
+journalCursorFile="jounalCursorFile"
+
 startStrace() {
     coproc strace -qq -p 1 -o $straceLog -e set_mempolicy -s 1024 $1
 }
@@ -38,18 +41,16 @@ stopStrace() {
 }
 
 startJournalctl() {
-    coproc journalctl -u init.scope -f > $journalLog
+    # Save journal's cursor for later navigation
+    journalctl --no-pager --cursor-file="$journalCursorFile" -n0 -ocat
 }
 
 stopJournalctl() {
-    # Wait a few seconds until the messages get properly queued...
-    sleep $journalSleep
-    # ...and then force journald to write them to the backing storage
-    # Also, using journalctl --sync should be better than using SIGRTMIN+1, as
+    # Using journalctl --sync should be better than using SIGRTMIN+1, as
     # the --sync wait until the synchronization is complete
     echo "Force journald to write all queued messages"
     journalctl --sync
-    kill -s TERM $COPROC_PID
+    journalctl -u init.scope --cursor-file="$journalCursorFile" > "$journalLog"
 }
 
 checkNUMA() {