public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] gdb/testsuite: Detect and warn about duplicate test names
Date: Thu, 23 Apr 2020 13:28:08 -0700	[thread overview]
Message-ID: <c2b927c9-75d6-709d-a325-3aa4a887be04@redhat.com> (raw)
In-Reply-To: <6f747a57bd458c013a6f61452e568c30a85cf9a4.1587663712.git.andrew.burgess@embecosm.com>

On 4/23/20 10:53 AM, Andrew Burgess wrote:
> Spots when tests reuse the same test name and prints a new result type
> '# of duplicate test names' in the result summary.

The above reads awkwardly. Or I'm awkward. Take your pick. :-)

> 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.  A later commit will fix this.

I don't know how others approach testing, but when I add new/modify
tests, I always run them separately first without parallelization. This would
still catch any mistakes I might make.

So from my perspective, it's a still a win!

My only comment is a reiteration of the namespace wrapping I encouraged
in the last patch.

Keith

> diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp
> index 6377ace3fc3..85520191f27 100644
> --- a/gdb/testsuite/lib/check-test-names.exp
> +++ b/gdb/testsuite/lib/check-test-names.exp
> @@ -22,6 +22,13 @@
>  # or the build path.
>  set paths_in_test_names 0
>  
> +# An associative array of all test names to the number of times each
> +# name is seen.  Used to detect duplicate test names.
> +array set all_test_names {}
> +
> +# A count of the number of duplicte test names seen.
> +set duplicate_test_names_seen 0
> +
>  # Check if MESSAGE contains either the source path or the build path.
>  # This will result in test names that can't easily be compared between
>  # different runs of GDB.
> @@ -31,6 +38,8 @@ set paths_in_test_names 0
>  proc check_test_names { message } {
>      global srcdir objdir
>      global paths_in_test_names
> +    global all_test_names
> +    global duplicate_test_names_seen
>  
>      foreach pattern [list $srcdir $objdir] {
>  	if { [ regexp $pattern $message ] } {
> @@ -39,6 +48,16 @@ proc check_test_names { message } {
>  	    return
>  	}
>      }
> +
> +    # Initialise a count, or increment the count for this test name.
> +    if {![info exists all_test_names($message)]} {
> +	set all_test_names($message) 0
> +    } else {
> +	if {$all_test_names($message) == 0} {
> +	    incr duplicate_test_names_seen
> +	}
> +	incr all_test_names($message)
> +    }
>  }
>  
>  # Arrange for CHECK_TEST_NAMES to be called.
> @@ -58,6 +77,7 @@ set local_record_procs(unsupported) "check_test_names"
>  rename log_summary original_log_summary
>  proc log_summary { args } {
>      global paths_in_test_names
> +    global duplicate_test_names_seen
>  
>      # If ARGS is the empty list then we don't want to pass a single
>      # empty string as a parameter here.
> @@ -66,6 +86,10 @@ proc log_summary { args } {
>      if { $paths_in_test_names > 0 } {
>  	clone_output "# of paths in test names\t${paths_in_test_names}"
>      }
> +
> +    if { $duplicate_test_names_seen > 0 } {
> +	clone_output "# of duplicate test names\t${duplicate_test_names_seen}"
> +    }
>  }
>  
>  # Wrapper around the global Dejagnu RESET_VARS procedure, resets our
> @@ -73,7 +97,12 @@ proc log_summary { args } {
>  rename reset_vars original_reset_vars
>  proc reset_vars {} {
>      global paths_in_test_names
> +    global all_test_names
> +    global duplicate_test_names_seen
>  
>      original_reset_vars
> +
>      set paths_in_test_names 0
> +    unset all_test_names
> +    set duplicate_test_names_seen 0
>  }
> 


  reply	other threads:[~2020-04-23 20:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 17:53 [PATCH 0/4] Automatic detection of test name problems Andrew Burgess
2020-04-23 17:53 ` [PATCH 1/4] gdb/testsuite: Remove build paths from test names Andrew Burgess
2020-04-24 14:00   ` Simon Marchi
2020-04-23 17:53 ` [PATCH 2/4] gdb/testsuite: Detect and warn if paths are used in " Andrew Burgess
2020-04-23 20:26   ` Keith Seitz
2020-04-27 15:58     ` Andrew Burgess
2020-04-27 16:42       ` Keith Seitz
2020-04-27 19:06         ` Andrew Burgess
2020-04-23 17:53 ` [PATCH 3/4] gdb/testsuite: Detect and warn about duplicate " Andrew Burgess
2020-04-23 20:28   ` Keith Seitz [this message]
2020-04-23 17:53 ` [PATCH 4/4] contrib: Handle GDB specific test result types Andrew Burgess
2020-04-23 20:25 ` [PATCH 0/4] Automatic detection of test name problems Keith Seitz
2020-04-27 22:01 ` [PATCHv2 0/3] " Andrew Burgess
2020-04-27 22:01   ` [PATCHv2 1/3] gdb/testsuite: Detect and warn if paths are used in test names Andrew Burgess
2020-04-27 22:01   ` [PATCHv2 2/3] gdb/testsuite: Detect and warn about duplicate " Andrew Burgess
2020-04-27 22:01   ` [PATCHv2 3/3] contrib: Handle GDB specific test result types Andrew Burgess
2020-04-28 19:08   ` [PATCHv2 0/3] Automatic detection of test name problems Keith Seitz
2020-04-29  9:02     ` Andrew Burgess
2020-04-29 15:04       ` Simon Marchi
2020-04-29 15:38         ` Andrew Burgess
2020-04-29 16:03           ` Keith Seitz
2020-04-29 18:22             ` Simon Marchi
2020-04-30 11:20   ` [PATCHv3 " Andrew Burgess
2020-04-30 11:20     ` [PATCHv3 1/3] gdb/testsuite: Detect and warn if paths are used in test names Andrew Burgess
2020-04-30 11:20     ` [PATCHv3 2/3] gdb/testsuite: Detect and warn about duplicate " Andrew Burgess
2020-07-31 21:34       ` Simon Marchi
2020-08-03 10:02         ` Andrew Burgess
2020-08-03 12:18           ` Simon Marchi
2020-04-30 11:20     ` [PATCHv3 3/3] contrib: Handle GDB specific test result types Andrew Burgess
2020-04-30 18:01     ` [PATCHv3 0/3] Automatic detection of test name problems Tom Tromey
2020-05-11 21:30     ` Andrew Burgess
2020-05-12 16:48       ` Andrew Burgess

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=c2b927c9-75d6-709d-a325-3aa4a887be04@redhat.com \
    --to=keiths@redhat.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@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).