]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Detect trailing-text-in-parentheses duplicates
authorTom de Vries <tdevries@suse.de>
Wed, 31 Jul 2024 13:04:25 +0000 (15:04 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 31 Jul 2024 13:04:25 +0000 (15:04 +0200)
commit35f09cd5d7fdd1a64f4d1751e73c3495bef1ed99
tree78266ecbffb4d52f66da9254fb05a72a9aecd6f3
parent61ed16ee6341535924e5e601964afc6c256258e6
[gdb/testsuite] Detect trailing-text-in-parentheses duplicates

When using a duplicate test name:
...
fail foo
fail foo
...
we get:
...
FAIL: $exp: foo
FAIL: $exp: foo
DUPLICATE: $exp: foo
...

But when we do:
...
fail foo
fail "foo (timeout)"
...
we get only:
...
FAIL: $exp: foo
FAIL: $exp: foo (timeout)
...

Trailing text between parentheses prefixed with a space is interpreted as
extra information, and not as part of the test name [1].

Consequently, "foo" and "foo (timeout)" do count as duplicate test names,
which should have been detected.  This is PR testsuite/29772.

Fix this in CheckTestNames::_check_duplicates, such that we get:
...
FAIL: $exp: foo
FAIL: $exp: foo (timeout)
DUPLICATE: $exp: foo (timeout)
...

[ One note on the implementation: I used the regexp { \([^()]*\)$}. I don't
know whether that covers all required cases, due to the fact that those are
not unambiguousely specified.  It might be possible to reverse-engineer that
information by reading or running the "regression analysis tools" mentioned on
the wiki page [1], but I haven't been able to.  Regardless, the current regexp
covers a large amount of cases, which IMO should be sufficient to be
acceptable. ]

Doing so shows many new duplicates in the testsuite.

A significant number of those is due to using a message which is a copy of the
command:
...
gdb_test "print (1)"
...

Fix this by handling those cases using test names "gdb-command<print (1)>" and
"gdb-command<print (2)>.

Fix the remaining duplicates manually (split off as follow-up patch for
readability of this patch).

Tested on x86_64-linux and aarch64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29772

[1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
gdb/testsuite/lib/check-test-names.exp
gdb/testsuite/lib/gdb.exp