dryang / rpms / systemd

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