Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Check for valid test name
Date: Mon, 13 Sep 2021 15:26:27 +0100	[thread overview]
Message-ID: <20210913142627.GA61506@embecosm.com> (raw)
In-Reply-To: <20210913071908.GA3469@delia.home>

* Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> [2021-09-13 09:19:11 +0200]:

> Hi,
> 
> When running gdb.base/batch-exit-status.exp I noticed that the test name
> contains a newline:
> ...
> PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
> : No such file or directory\.: [lindex $result 2] == 0
> ...
> 
> Check for this in ::CheckTestNames::check, such that we have a warning:
> ...
> PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
> : No such file or directory\.: [lindex $result 2] == 0
> WARNING: Newline in test name
> ...
> 
> Tested on x86_64-linux.
> 
> Any comments?
> 
> Thanks,
> - Tom
> 
> [gdb/testsuite] Check for valid test name
> 
> ---
>  gdb/testsuite/lib/check-test-names.exp | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp
> index 1de7624d5c5..db76abab990 100644
> --- a/gdb/testsuite/lib/check-test-names.exp
> +++ b/gdb/testsuite/lib/check-test-names.exp
> @@ -93,6 +93,13 @@ namespace eval ::CheckTestNames {
>  	return $message
>      }
>  
> +    # Check if MESSAGE is a well-formed test name.
> +    proc _check_name { message } {

I think `_check_newline` would be a better name.

> +	if { [regexp \n $message]} {
> +	    warning "Newline in test name"
> +	}

If I run the entire testsuite I guess these warnings will likely get
lost in the output, unlike the DUPLICATE/PATH warnings, which are
listed along with the other PASS/FAIL/etc results.

Did you check to see if this warning occurs any other times in the
testsuite right now?  I guess if we're clean right now then having
this as a warning is fine, as we should spot this when adding new
tests.

I'm happy with this though (with the name change above).

Thanks,
Andrew


> +    }
> +
>      # 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.
> @@ -110,6 +117,8 @@ namespace eval ::CheckTestNames {
>  	if [ _check_duplicates $message ] {
>  	    clone_output "DUPLICATE: $message"
>  	}
> +
> +	_check_name $message
>      }
>  
>      # If COUNT is greater than zero, disply PREFIX followed by COUNT.

  reply	other threads:[~2021-09-13 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  7:19 Tom de Vries via Gdb-patches
2021-09-13 14:26 ` Andrew Burgess [this message]
2021-09-13 18:37   ` Tom de Vries via Gdb-patches

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=20210913142627.GA61506@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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