naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
c2dfb7
From d6d43b81df76d571d57f83ceb050c8b4ac4701b8 Mon Sep 17 00:00:00 2001
c2dfb7
From: Frantisek Sumsal <frantisek@sumsal.cz>
c2dfb7
Date: Mon, 1 Jul 2019 13:08:26 +0200
c2dfb7
Subject: [PATCH] test: support MPOL_LOCAL matching in unpatched strace
c2dfb7
 versions
c2dfb7
c2dfb7
The MPOL_LOCAL constant is not recognized in current strace versions.
c2dfb7
Let's match at least the numerical value of this constant until the
c2dfb7
strace patch is approved & merged.
c2dfb7
c2dfb7
(cherry picked from commit ac14396d027023e1be910327989cb422cb2f6724)
c2dfb7
c2dfb7
Related: #1808940
c2dfb7
---
c2dfb7
 test/TEST-36-NUMAPOLICY/testsuite.sh | 12 ++++++++----
c2dfb7
 1 file changed, 8 insertions(+), 4 deletions(-)
c2dfb7
c2dfb7
diff --git a/test/TEST-36-NUMAPOLICY/testsuite.sh b/test/TEST-36-NUMAPOLICY/testsuite.sh
c2dfb7
index 306a96b517..a4134bdeca 100755
c2dfb7
--- a/test/TEST-36-NUMAPOLICY/testsuite.sh
c2dfb7
+++ b/test/TEST-36-NUMAPOLICY/testsuite.sh
c2dfb7
@@ -173,12 +173,16 @@ echo "PID1 NUMAPolicy support - Local policy w/o mask"
c2dfb7
 writePID1NUMAPolicy "local"
c2dfb7
 pid1ReloadWithStrace
c2dfb7
 # Kernel requires that nodemask argument is set to NULL when setting default policy
c2dfb7
-grep "set_mempolicy(MPOL_LOCAL, NULL" $straceLog
c2dfb7
+# The unpatched versions of strace don't recognize the MPOL_LOCAL constant and
c2dfb7
+# return a numerical constant instead (with a comment):
c2dfb7
+#   set_mempolicy(0x4 /* MPOL_??? */, NULL, 0) = 0
c2dfb7
+# Let's cover this scenario as well
c2dfb7
+grep -E "set_mempolicy\((MPOL_LOCAL|0x4 [^,]*), NULL" $straceLog
c2dfb7
 
c2dfb7
 echo "PID1 NUMAPolicy support - Local policy w/ mask"
c2dfb7
 writePID1NUMAPolicy "local" "0"
c2dfb7
 pid1ReloadWithStrace
c2dfb7
-grep "set_mempolicy(MPOL_LOCAL, NULL" $straceLog
c2dfb7
+grep -E "set_mempolicy\((MPOL_LOCAL|0x4 [^,]*), NULL" $straceLog
c2dfb7
 
c2dfb7
 echo "Unit file NUMAPolicy support - Default policy w/o mask"
c2dfb7
 writeTestUnitNUMAPolicy "default"
c2dfb7
@@ -240,7 +244,7 @@ writeTestUnitNUMAPolicy "local"
c2dfb7
 pid1StartUnitWithStrace $testUnit
c2dfb7
 systemctlCheckNUMAProperties $testUnit "local"
c2dfb7
 pid1StopUnit $testUnit
c2dfb7
-grep "set_mempolicy(MPOL_LOCAL, NULL" $straceLog
c2dfb7
+grep -E "set_mempolicy\((MPOL_LOCAL|0x4 [^,]*), NULL" $straceLog
c2dfb7
 
c2dfb7
 echo "Unit file NUMAPolicy support - Local policy w/ mask"
c2dfb7
 writeTestUnitNUMAPolicy "local" "0"
c2dfb7
@@ -248,7 +252,7 @@ pid1StartUnitWithStrace $testUnit
c2dfb7
 systemctlCheckNUMAProperties $testUnit "local" "0"
c2dfb7
 pid1StopUnit $testUnit
c2dfb7
 # Maks must be ignored
c2dfb7
-grep "set_mempolicy(MPOL_LOCAL, NULL" $straceLog
c2dfb7
+grep -E "set_mempolicy\((MPOL_LOCAL|0x4 [^,]*), NULL" $straceLog
c2dfb7
 
c2dfb7
 echo "systemd-run NUMAPolicy support"
c2dfb7
 runUnit='numa-systemd-run-test.service'