]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: Detect and warn if paths are used in test names
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 23 Apr 2020 09:47:29 +0000 (10:47 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 11 May 2020 21:26:52 +0000 (22:26 +0100)
commit34584c091bb4414cea6531269f435b2938b2d8e6
treea97a3c3932037f3b0bd9fe392f7216b0999c293c
parent5eb68a39a2c2908fc01f03e79daed72ba85dc14c
gdb/testsuite: Detect and warn if paths are used in test names

A new library is introduced that hooks into the core of Dejagnu and
detects when a test's name includes either the source or build paths.
If any offending test names are detected then Dejagnu will print a
new result type, '# of paths in test names'.  Users should treat this
result type just like other bad results types, and aim not to increase
this number.

As well as displaying the total number of offending tests as part of
the final results, a new marker is included in both the gdb.log and
gdb.sum files, this marker starts with 'PATH: ', so an offending test
would be expected to appear like this:

  PASS: gdb.base/sometest.exp: Loaded /path/to/build/testsuite/foo.exe
  PATH: gdb.base/sometest.exp: Loaded /path/to/build/testsuite/foo.exe

This should make it easier to track down offending tests.

Currently for a local run on my machine, I don't see any offending
test names, but it is possible that different targets, or different
configurations, might currently be breaking the no paths rule.

In order to get this working I have needed to wrap two core Dejagnu
functions, log_summary, and reset_vars.  Relying on core functions
that are not part of any API is always going to be risky, given the
relatively slow rate of Dejagnu change this is probably OK for now,
and we can possibly upstream some changes to Dejagnu that would allow
this functionality to be supported in a more official way later on.

Currently if the tests are run in parallel mode the new result type is
not merged into the combined summary file so users will need to run in
non-parallel mode to check this result.  Similarly, the 'PATH: '
markers will not be merged into the combined summary file.  A later
commit will fix this.

gdb/testsuite/ChangeLog:

* lib/gdb.exp: Include check-test-names.exp library.
* lib/check-test-names.exp: New file.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/check-test-names.exp [new file with mode: 0644]
gdb/testsuite/lib/gdb.exp