daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
5d2ee9
From b93a2617d49d9636801130d974995cabe6335b71 Mon Sep 17 00:00:00 2001
5d2ee9
From: Frantisek Sumsal <frantisek@sumsal.cz>
5d2ee9
Date: Mon, 1 Jul 2019 09:27:59 +0200
5d2ee9
Subject: [PATCH 334/341] test: replace `tail -f` with journal cursor which
5d2ee9
 should be...
5d2ee9
5d2ee9
more reliable
5d2ee9
5d2ee9
(cherry picked from commit d0b2178f3e79f302702bd7140766eee03643f734)
5d2ee9
5d2ee9
Related: #1808940
5d2ee9
---
5d2ee9
 test/TEST-36-NUMAPOLICY/testsuite.sh | 13 +++++++------
5d2ee9
 1 file changed, 7 insertions(+), 6 deletions(-)
5d2ee9
5d2ee9
diff --git a/test/TEST-36-NUMAPOLICY/testsuite.sh b/test/TEST-36-NUMAPOLICY/testsuite.sh
5d2ee9
index e15087b137..306a96b517 100755
5d2ee9
--- a/test/TEST-36-NUMAPOLICY/testsuite.sh
5d2ee9
+++ b/test/TEST-36-NUMAPOLICY/testsuite.sh
5d2ee9
@@ -29,6 +29,9 @@ testUnitNUMAConf="$testUnitFile.d/numa.conf"
5d2ee9
 journalSleep=5
5d2ee9
 sleepAfterStart=1
5d2ee9
 
5d2ee9
+# Journal cursor for easier navigation
5d2ee9
+journalCursorFile="jounalCursorFile"
5d2ee9
+
5d2ee9
 startStrace() {
5d2ee9
     coproc strace -qq -p 1 -o $straceLog -e set_mempolicy -s 1024 $1
5d2ee9
 }
5d2ee9
@@ -38,18 +41,16 @@ stopStrace() {
5d2ee9
 }
5d2ee9
 
5d2ee9
 startJournalctl() {
5d2ee9
-    coproc journalctl -u init.scope -f > $journalLog
5d2ee9
+    # Save journal's cursor for later navigation
5d2ee9
+    journalctl --no-pager --cursor-file="$journalCursorFile" -n0 -ocat
5d2ee9
 }
5d2ee9
 
5d2ee9
 stopJournalctl() {
5d2ee9
-    # Wait a few seconds until the messages get properly queued...
5d2ee9
-    sleep $journalSleep
5d2ee9
-    # ...and then force journald to write them to the backing storage
5d2ee9
-    # Also, using journalctl --sync should be better than using SIGRTMIN+1, as
5d2ee9
+    # Using journalctl --sync should be better than using SIGRTMIN+1, as
5d2ee9
     # the --sync wait until the synchronization is complete
5d2ee9
     echo "Force journald to write all queued messages"
5d2ee9
     journalctl --sync
5d2ee9
-    kill -s TERM $COPROC_PID
5d2ee9
+    journalctl -u init.scope --cursor-file="$journalCursorFile" > "$journalLog"
5d2ee9
 }
5d2ee9
 
5d2ee9
 checkNUMA() {
5d2ee9
-- 
5d2ee9
2.21.1
5d2ee9