public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/29772] New: [gdb/testsuite] Detect duplicates for "FAIL: foo" and "FAIL: foo (timeout)"
Date: Thu, 10 Nov 2022 10:57:06 +0000	[thread overview]
Message-ID: <bug-29772-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-11-10 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 10:57 vries at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29772-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).