]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
strace-tst-thp.sh: Allow unsupported THP tests
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 3 Jul 2026 02:17:20 +0000 (10:17 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 15 Jul 2026 11:27:16 +0000 (19:27 +0800)
Change strace-tst-thp.sh to

output=${test_prog}.$$
...
/bin/sh -c \
  "timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1" > "${output}"
if grep -E "madvise\(0x[0-9a-f]+, [0-9]+, 0xe)" "${output}"; then
...

so that unsupported THP tests exit with status 77.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/unix/sysv/linux/strace-tst-thp.sh

index bff7d3e7a0233ed9cb3ebb9374a80b99d9445f43..0ad10c3ac233c937d27d34f88ac812a1c7c63b32 100644 (file)
@@ -23,6 +23,9 @@ rtld="$1"
 test_wrapper_env="$2"
 run_program_env="$3"
 test_prog="$4"
+output=${test_prog}.$$
+
+trap "rm -f ${output}" EXIT
 
 cmd="${test_wrapper_env} ${run_program_env} strace -X raw ${rtld} ${test_prog}"
 
@@ -45,18 +48,19 @@ esac
 
 # Finally the actual test inside the test environment, using the just
 # build ld.so and new libraries to run the THP test under strace.
-if /bin/sh -c \
-  "timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1 \
-   | grep -E \"madvise\(0x[0-9a-f]+, [0-9]+, 0xe)\""; then
+/bin/sh -c \
+  "timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1" > "${output}"
+if grep -E "madvise\(0x[0-9a-f]+, [0-9]+, 0xe)" "${output}"; then
   if test ${strace_expected} = yes; then
-    exit 0
+    status=0
   else
-    exit 1
+    status=1
   fi
 else
   if test ${strace_expected} = no; then
-    exit 0
+    status=0
   else
-    exit 1
+    status=1
   fi
 fi
+exit ${status}