public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/29772] New: [gdb/testsuite] Detect duplicates for "FAIL: foo" and "FAIL: foo (timeout)"
@ 2022-11-10 10:57 vries at gcc dot gnu.org
  2022-11-10 12:53 ` [Bug testsuite/29772] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-10 10:57 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29772
           Summary: [gdb/testsuite] Detect duplicates for "FAIL: foo" and
                    "FAIL: foo (timeout)"
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I noticed here ( https://sourceware.org/gdb/wiki/GDBTestcaseCookbook ):
...
Do not use "tail parentheses" on test messages

When you write a test, do not put text between parentheses preceded by a space
at the end of the text message. For example, this is incorrect:

gdb_test "some_test" "expected output" "I am a test message (123)"
...

I then noticed that when checking for duplicates, we do detect:
...
FAIL: gdb.testsuite/duplicate.exp: foo
FAIL: gdb.testsuite/duplicate.exp: foo
...
but not:
...
FAIL: gdb.testsuite/duplicate.exp: foo
FAIL: gdb.testsuite/duplicate.exp: foo (timeout)
...

I wrote a patch to fix this:
...
diff --git a/gdb/testsuite/lib/check-test-names.exp
b/gdb/testsuite/lib/check-test
-names.exp
index 752981c7888..fac93259464 100644
--- a/gdb/testsuite/lib/check-test-names.exp
+++ b/gdb/testsuite/lib/check-test-names.exp
@@ -64,6 +64,9 @@ namespace eval ::CheckTestNames {
     proc _check_duplicates { message } {
        variable all_test_names

+       # Remove the "extra information" part.
+       set message [regsub { \(.*\)$} $message ""]
+
        # Initialise a count, or increment the count for this test name.
        if {![info exists all_test_names($message)]} {
            set all_test_names($message) 0
...

I ran into 6453 duplicates in 134 test-cases:
...
$ grep DUPLICATE: gdb.sum | wc -l
6453
$ grep DUPLICATE: gdb.sum | awk '{print $2}' | sort -u | wc -l
134
...

For instance:
...
DUPLICATE: gdb.arch/amd64-osabi.exp: arch=i386:x86-64: print sizeof (long
double)
DUPLICATE: gdb.arch/amd64-osabi.exp: arch=i386:x64-32: print sizeof (long
double)
DUPLICATE: gdb.arch/amd64-osabi.exp: arch=i386: print sizeof (long double)
...

It may be worthwhile to override all pass / fail procs to do some automated
test name substitution:
...
-PASS: gdb.arch/amd64-osabi.exp: arch=i386:x86-64: print sizeof (long double)
+PASS: gdb.arch/amd64-osabi.exp: arch=i386:x86-64: print sizeof _(long double)_
...
and create extra versions fail_with_info to do:
...
-fail "$testname (timeout)"
+fail_with_info $testname "timeout"
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-01-22 21:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 10:57 [Bug testsuite/29772] New: [gdb/testsuite] Detect duplicates for "FAIL: foo" and "FAIL: foo (timeout)" vries at gcc dot gnu.org
2022-11-10 12:53 ` [Bug testsuite/29772] " vries at gcc dot gnu.org
2022-12-06 18:45 ` pedro at palves dot net
2023-01-22 17:58 ` tromey at sourceware dot org
2023-01-22 21:53 ` tromey at sourceware dot org

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).