public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: add details to failures in gdb_test_multiple
@ 2020-12-15  4:07 Simon Marchi
  2020-12-15  5:37 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Marchi @ 2020-12-15  4:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@efficios.com>

Some fails in gdb_test_multiple already include a description of why the
failure happened in parenthesis.  Add such a description to more cases,
this will hopefully help a little bit when tracking failures (at least
it helped me).

As a reminder: the trailing parenthesis is ignored when comparing test
names, so it's a good way to provide some insight in on the failure.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_test_multiple): Add descriptions to failures.

Change-Id: I6d7c9ed4450b388fbc2729f302abffba766b7ba6
---
 gdb/testsuite/lib/gdb.exp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 94bdf1ac856f..a47355b39799 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1098,12 +1098,12 @@ proc gdb_test_multiple { command message args } {
 	}
 	-re "Undefined\[a-z\]* command:.*$prompt_regexp" {
 	    perror "Undefined command \"$command\"."
-	    fail "$message"
+	    fail "$message (undefined command)"
 	    set result 1
 	}
 	-re "Ambiguous command.*$prompt_regexp" {
 	    perror "\"$command\" is not a unique command name."
-	    fail "$message"
+	    fail "$message (ambiguous command)"
 	    set result 1
 	}
 	-re "$inferior_exited_re with code \[0-9\]+.*$prompt_regexp" {
@@ -1135,14 +1135,14 @@ proc gdb_test_multiple { command message args } {
 	}
 	-re "\r\n$prompt_regexp" {
 	    if ![string match "" $message] then {
-		fail "$message"
+		fail "$message (got prompt)"
 	    }
 	    set result 1
 	}
 	-re "$pagination_prompt" {
 	    send_gdb "\n"
 	    perror "Window too small."
-	    fail "$message"
+	    fail "$message (got pagination)"
 	    set result -1
 	}
 	-re "\\((y or n|y or \\\[n\\\]|\\\[y\\\] or n)\\) " {
@@ -1164,7 +1164,7 @@ proc gdb_test_multiple { command message args } {
 	    set wait_status [wait -i $gdb_spawn_id]
 	    verbose -log "GDB process exited with wait status $wait_status"
 	    if { $message != "" } {
-		fail "$message"
+		fail "$message (GDB process no longer exists)"
 	    }
 	    return -1
 	}
@@ -1184,13 +1184,13 @@ proc gdb_test_multiple { command message args } {
 	eof {
 	    perror "Process no longer exists"
 	    if { $message != "" } {
-		fail "$message"
+		fail "$message (process no longer exists)"
 	    }
 	    return -1
 	}
 	full_buffer {
 	    perror "internal buffer is full."
-	    fail "$message"
+	    fail "$message (internal buffer is full)"
 	    set result -1
 	}
 	timeout	{
-- 
2.29.2


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

* Re: [PATCH] gdb/testsuite: add details to failures in gdb_test_multiple
  2020-12-15  4:07 [PATCH] gdb/testsuite: add details to failures in gdb_test_multiple Simon Marchi
@ 2020-12-15  5:37 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2020-12-15  5:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

On 2020-12-14 11:07 p.m., Simon Marchi via Gdb-patches wrote:
> From: Simon Marchi <simon.marchi@efficios.com>
> 
> Some fails in gdb_test_multiple already include a description of why the
> failure happened in parenthesis.  Add such a description to more cases,
> this will hopefully help a little bit when tracking failures (at least
> it helped me).
> 
> As a reminder: the trailing parenthesis is ignored when comparing test
> names, so it's a good way to provide some insight in on the failure.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* lib/gdb.exp (gdb_test_multiple): Add descriptions to failures.
> 
> Change-Id: I6d7c9ed4450b388fbc2729f302abffba766b7ba6
> ---
>  gdb/testsuite/lib/gdb.exp | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 94bdf1ac856f..a47355b39799 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -1098,12 +1098,12 @@ proc gdb_test_multiple { command message args } {
>  	}
>  	-re "Undefined\[a-z\]* command:.*$prompt_regexp" {
>  	    perror "Undefined command \"$command\"."
> -	    fail "$message"
> +	    fail "$message (undefined command)"
>  	    set result 1
>  	}
>  	-re "Ambiguous command.*$prompt_regexp" {
>  	    perror "\"$command\" is not a unique command name."
> -	    fail "$message"
> +	    fail "$message (ambiguous command)"
>  	    set result 1
>  	}
>  	-re "$inferior_exited_re with code \[0-9\]+.*$prompt_regexp" {
> @@ -1135,14 +1135,14 @@ proc gdb_test_multiple { command message args } {
>  	}
>  	-re "\r\n$prompt_regexp" {
>  	    if ![string match "" $message] then {
> -		fail "$message"
> +		fail "$message (got prompt)"

Err this doesn't work for kfails and xfails.  It changes

XFAIL: gdb.base/annotate-symlink.exp: continue (PRMS 24915)

into

XFAIL: gdb.base/annotate-symlink.exp: continue (got prompt) (PRMS 24915)

Only the trailing parenthesis gets ignored in the test name, so this won't work.  Not
sure how to fix that.

Simon

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

end of thread, other threads:[~2020-12-15  5:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  4:07 [PATCH] gdb/testsuite: add details to failures in gdb_test_multiple Simon Marchi
2020-12-15  5:37 ` Simon Marchi

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