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

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <CAMe9rOqUokwcVWg683RT3AiEqdrzwwN-EySdmRgsF1895pqvAg@mail.gmail.com>
On Wed, Jul 15, 2026 at 4:39 AM Adhemerval Zanella Netto
<[email protected]> wrote:
>
>
>
> On 04/07/26 00:06, H.J. Lu wrote:
> > 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 <[email protected]>
> > ---
> >  sysdeps/unix/sysv/linux/strace-tst-thp.sh | 21 +++++++++++++--------
> >  1 file changed, 13 insertions(+), 8 deletions(-)
> >
> > diff --git a/sysdeps/unix/sysv/linux/strace-tst-thp.sh b/sysdeps/unix/sysv/linux/strace-tst-thp.sh
> > index bff7d3e7a0..7a3c0e1e33 100644
> > --- a/sysdeps/unix/sysv/linux/strace-tst-thp.sh
> > +++ b/sysdeps/unix/sysv/linux/strace-tst-thp.sh
> > @@ -17,12 +17,15 @@
> >  # License along with the GNU C Library; if not, see
> >  # <https://www.gnu.org/licenses/>.
> >
> > -set -e
> > +set -eE
>
> Unfortunately this is bash-only and Makefile will issue $(SHELL) even the
> shebang requires bash (it will fail with dash for instance, and I think
> it is redundant anyway).
>
> I think you can just use -e here with the following changes:

We need "set -eE" so that the strace command will exit with
77.  I reverted my patch and sent the v4 patch with $(BASH)
instead of $(SHELL).

> >
> >  rtld="$1"
> >  test_wrapper_env="$2"
> >  run_program_env="$3"
> >  test_prog="$4"
> > +output=${test_prog}.$$
> > +
> > +trap "rm -f ${output}" ERR
>
> Use 'trap 'rm -f "${output}"' EXIT' instead.
>
> >
> >  cmd="${test_wrapper_env} ${run_program_env} strace -X raw ${rtld} ${test_prog}"
> >
> > @@ -45,18 +48,20 @@ 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
>
> Also use double-score on ${output}.
>
> > -    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
> > +rm -f ${output}
>
> This is also redundant with 'trap ... EXIT'.
>
> > +exit ${status}
>


-- 
H.J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.