public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* testsuite/run_dump_test improvement
@ 2020-05-05  3:54 Fangrui Song
  2020-05-06  1:50 ` Hans-Peter Nilsson
  2020-05-06 13:44 ` Nick Clifton
  0 siblings, 2 replies; 4+ messages in thread
From: Fangrui Song @ 2020-05-05  3:54 UTC (permalink / raw)
  To: binutils

Hi all, may the force be with you!

I have known check-gas, check-ld and check-binutils for a while, as well
as "many tests are organized as these *.d files", but I know very little
about the underlying test framework. TIL
binutils/testsuite/lib/binutils-common.exp run_dump_test is the core
that runs as, ld, and checks the output of a dump program matches the
expected patterns in the .d file (or #dump:).

Here is my first complaint: the test framework is undocumented.

2) Can we write comments in *.d?

3) Can we allow free-form shell commands instead of specialized directives?

It is mythical what can and what can't be used in `#foo:`.
OK, a user can figure out this with trial and error. Then,
why can't we have multiple dump programs? Frequently we need to check
multiple properties of an output and a single dump program just does not
work well.  The limitation led to some ad-hoc directives like `#map:`.
For example, ld-ifunc/ifunc-1-x86.d says

   #ld: -shared -Map tmpdir/ifunc-1-x86.map --hash-style=sysv
   #objdump: -dw
   #target: x86_64-*-* i?86-*-*
   #map: ifunc-1-x86.map
   
   #...
   [ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x[0-9a-f]+|)@plt>
   #pass

If we allow free-form shell commands and use line prefixes to differentiate the two output streams (objdump -d output and ld -Map output):

   ## Test local ifunc are dumped in the link map.
   #RUN: ld: -shared -Map tmpdir/ifunc-1-x86.map --hash-style=sysv %s -o %t
   #RUN: objdump -dw %t | check  # by default, CHECK is the prefix
   #RUN: cat tmpdir/ifunc-1-x86.map | check MAP

   #CHECK: [ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x[0-9a-f]+|)@plt>
   #CHECK-N: if there is a next line
   #CHECK-N: likewise.
   #CHECK:   skip arbitrary lines
   #CHECK-N: if there is a next line

   #MAP: Local IFUNC function ...

4) It may be nice for the pattern matching tool to recognize a substring by default.
Let {{^}}, {{$}}, or some other metacharacters to denote that "the full line should be matched"

5) It may be nice to use more descriptive filenames than *-1.d, *-2.d, or prXXXXX.d
   prXXXXX can be mentioned as comments if we allow 2)

   As it stands, many tests require guesswork before you open them in an editor.

6) Parallelism

   runtest --tool ld --srcdir ../../ld/testsuite/ took more than 2 hours
   to run on my machine. I'd expect a few seconds for a more pleasant experience.

7) Run an individual test, rather than runtest ...

I figured out that I can run partial tests with:

   # my build directory is $srcdir/Debug
   cd Debug/ld
   runtest --tool ld --srcdir ../../ld/testsuite export-dynamic-symbol.exp

but it would be convenient to be able to run just one test.


Cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-18  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05  3:54 testsuite/run_dump_test improvement Fangrui Song
2020-05-06  1:50 ` Hans-Peter Nilsson
2020-05-06 13:44 ` Nick Clifton
2021-11-18  3:41   ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).