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

H.J. Lu hjl.tools@gmail.com
Thu Jul 16 21:26:42 GMT 2026


On Thu, Jul 16, 2026 at 6:44 PM Andreas Schwab <schwab@suse.de> wrote:
>
> diff --git a/sysdeps/unix/sysv/linux/strace-tst-thp.sh b/sysdeps/unix/sysv/linux/strace-tst-thp.sh
> index bff7d3e7a0..0bee37bb50 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,15 +37,14 @@ 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
> +# built ld.so and new libraries to run the THP test under strace.
> +output=$(timeout -k 4 $((3*$TIMEOUTFACTOR)) ${cmd} --direct 2>&1)
> +test $? = 77 && exit 77
> +if printf %s "${output}" | grep -E "madvise\(0x[0-9a-f]+, [0-9]+, 0xe)"; then
>    if test ${strace_expected} = yes; then
>      exit 0
>    else
>

These make certain assumptions about /bin/sh.   What is your /bin/sh?


-- 
H.J.


More information about the Libc-alpha mailing list