[v6] strace-tst-thp.sh: Allow unsupported THP tests

Message ID CAMe9rOoDjgn8oD-GQTc--hi3-NdzWiHfmmcHN5DWtKi+eG2nLQ@mail.gmail.com (mailing list archive)
State New
Headers
Series [v6] strace-tst-thp.sh: Allow unsupported THP tests |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

H.J. Lu July 21, 2026, 8:34 a.m. UTC
  Change strace-tst-thp.sh to check the command exit status so that
unsupported THP tests exit with status 77.
  

Comments

H.J. Lu Aug. 3, 2026, 1:48 a.m. UTC | #1
On Tue, Jul 21, 2026 at 4:34 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Change strace-tst-thp.sh to check the command exit status so that
> unsupported THP tests exit with status 77.
>

PING:

https://patchwork.sourceware.org/project/glibc/patch/CAMe9rOoDjgn8oD-GQTc--hi3-NdzWiHfmmcHN5DWtKi+eG2nLQ@mail.gmail.com/
  

Patch

From 664b271b81da6d57eefac7cd7d6b529dfbf5755c Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 4 Jul 2026 11:06:21 +0800
Subject: [PATCH v6] strace-tst-thp.sh: Allow unsupported THP tests

Change strace-tst-thp.sh to check the command exit status so that
unsupported THP tests exit with status 77.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 sysdeps/unix/sysv/linux/strace-tst-thp.sh | 24 +++++++++++------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/strace-tst-thp.sh b/sysdeps/unix/sysv/linux/strace-tst-thp.sh
index bff7d3e7a0..1c2b7255ac 100644
--- a/sysdeps/unix/sysv/linux/strace-tst-thp.sh
+++ b/sysdeps/unix/sysv/linux/strace-tst-thp.sh
@@ -1,4 +1,4 @@ 
-#!/bin/bash
+#!/bin/sh
 # Run THP test under strace to verify control of the THP segment load.
 # Copyright (C) 2026 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
@@ -17,8 +17,6 @@ 
 # License along with the GNU C Library; if not, see
 # <https://www.gnu.org/licenses/>.
 
-set -e
-
 rtld="$1"
 test_wrapper_env="$2"
 run_program_env="$3"
@@ -39,24 +37,24 @@  esac
 
 # Verify strace is not just present, but works in this environment.  If
 # not, skip the test.
-/bin/sh -c \
- "${test_wrapper_env} ${run_program_env} \
-  strace -X raw -e trace=none -- /bin/true" > /dev/null 2>&1 || exit 77
+${test_wrapper_env} ${run_program_env} \
+  strace -X raw -e trace=none -- /bin/true > /dev/null 2>&1 || exit 77
 
 # 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
+output=$(timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1)
+test $? = 77 && exit 77
+if echo "${output}" | grep -E "madvise\(0x[0-9a-f]+, [0-9]+, 0xe)"; 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}
-- 
2.55.0