[PATCH v2] Makefile: Fix elf/tst-trace tests

Yury Khrustalev yury.khrustalev@arm.com
Tue Nov 3 11:14:43 GMT 2026


On Mon, Nov 02, 2026 at 04:05:00PM -0300, Adhemerval Zanella Netto wrote:
> 
> On 02/11/26 10:48, Yury Khrustalev wrote:
> > The elf/tst-trace tests used
> > 
> >   ${ ... } $$@; $$(evaluate-test)
> > 
> > that ignored any errors inside ${ ... }. These braces seem to be
> > redundant and only mask any issues in the enclosed command.
> > 
> > Also fix underlying issue in tst-ld-trace.py that parsed command
> > line arguments incorrectly.
> > 
> > Suggested-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
> 
> This patch looks ok, two minor points below.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Thank you!

> ...
>
> >  import os
> >  import subprocess
> >  import sys
> > +import shlex
> >  
> >  try:
> >      subprocess.run
> > @@ -54,10 +55,8 @@ def is_vdso(lib):
> >  
> >  
> >  def parse_trace(cmd, fref):
> > -    new_env = os.environ.copy()
> > -    new_env['LD_TRACE_LOADED_OBJECTS'] = '1'
> > -    trace_out = subprocess.run(cmd, stdout=subprocess.PIPE, check=True,
> > -                               universal_newlines=True, env=new_env).stdout
> > +    trace_out = subprocess.run(shlex.split(cmd), stdout=subprocess.PIPE, check=True,
> > +                               universal_newlines=True).stdout
> 
> A test-wrapper="WRAPPER_DEBUG=1 /path/wrap" now fails with 
> FileNotFoundError: 'WRAPPER_DEBUG=1', while the same string with shell=True
> passes.
> 
> The manual/install.texi only documents 'cross-test-ssh.sh HOST', so this
> isn't a blocker. But other tests uses shell=True (like 
> elf/tst-rtld-list-diagnostics.py).

Good point. With 'shell=True' we don't need shlex.split(), so will
remove it as well.

> 
> ...
>
> > +    command, reference = argv
> > +    with open(reference, 'r') as fref:
> > +        parse_trace(command, fref)
> 
> The 'import argparse' is now unused, I think it should be removed.  A
> wrong argument count or invalid option now ends in a 'ValueError', but
> it should be ok (make check will fail anyway).

Yes, I thought that code to print a nice error message would be a bit
superfluous here since this script is meant to be called from the
makefile.

I'll push the change with this minor updates.

Thanks,
Yury



More information about the Libc-alpha mailing list