richardphibel / rpms / systemd

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