Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: Daniel Jacobowitz <drow@false.org>,
	gdb-patches@sourceware.org,
	       Richard Sandiford <rdsandiford@googlemail.com>
Subject: gdb_test_multiple and empty $message
Date: Thu, 26 Apr 2012 13:23:00 -0000	[thread overview]
Message-ID: <4F99491E.8050605@redhat.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1204252007360.19835@tp.orcam.me.uk>

On 04/25/2012 11:01 PM, Maciej W. Rozycki wrote:

>  Out of curiosity gdb_test_multiple contains this:
> 
>     if { $message == "" } {
> 	set message $command
>     }
> 
> at the very beginning, and then lots of pieces like this:
> 
> 	 -re "\\*\\*\\* DOSEXIT code.*" {
> 	     if { $message != "" } {
> 		 fail "$message";
> 	     }
> 	     gdb_suppress_entire_file "GDB died";
>              set result -1;
> 	 }
> 
> (this has weird indentation too, more cases elsewhere), or this:
> 
> 	    if ![string match "" $message] then {
> 		set errmsg "$message (the program exited)"
> 	    } else {
> 		set errmsg "$command (the program exited)"
> 	    }
> 
> or this:
> 
> 	timeout {
> 	    if ![string match "" $message] then {
> 		fail "$message (timeout)"
> 	    }
> 	    set result 1
> 	}
> 
> Are these meant to trigger where both the command and the message supplied 
> are empty?  Or are they just a leftover from past time?


Looking at the history, gdb_test_multiple was introduced as a split out of
gdb_test.   And it seems gdb_test already supported hidding a PASS by passing down
no message string even before gdb_test_multiple's introduction.  But this comment:

# MESSAGE is an optional message to be printed.  If this is
#   omitted, then the pass/fail messages use the command string as the
#   message.  (If this is the empty string, then sometimes we don't
#   call pass or fail at all; I don't understand this at all.)

already existed back then.

> Shouldn't the conditions be made consistent throughout, i.e. no fail invocation where 
> $message is ultimately still empty?  Or just removed?


My impression gdb_test without a message string is used at places we're
sending some commands that just prepare the real test.  It's a bit
arguable whether we should do that, but there you go.  But I think that hiding
an internal fail in such preparation steps, which are never ever expected to
fail (otherwise you'd pass down a message string to begin with) would be
actively harmful, and make it harder to grok and debug testsuite results.
For gdb_test_multiple itself, which never issues a "pass" itself, I think the
empty-message-means-command-string-is-the-message is really what people that
call it directly always expect, and likewise hiding an internal fail
for gdb_test_multiple direct call would be actively harmful, IMO.

So I suggest just removing the dead empty string tests from gdb_test_multiple,
making the non-empty paths unconditional.

-- 
Pedro Alves


  parent reply	other threads:[~2012-04-26 13:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 22:36 [RFA] MIPS/GDB: Fix the handling of MIPS16 thunks Maciej W. Rozycki
2012-04-11 19:16 ` Richard Sandiford
2012-04-12 13:09   ` Maciej W. Rozycki
2012-04-12 19:39     ` Richard Sandiford
2012-04-13 20:46       ` Maciej W. Rozycki
2012-04-20 14:54 ` Pedro Alves
2012-04-20 16:01   ` Maciej W. Rozycki
2012-04-21 18:55     ` Daniel Jacobowitz
2012-04-26  0:10     ` Maciej W. Rozycki
2012-04-26 13:10       ` Pedro Alves
2012-04-26 17:27         ` Maciej W. Rozycki
2012-04-26 13:23       ` Pedro Alves [this message]
2012-04-26 13:34         ` gdb_test_multiple and empty $message Pedro Alves
2012-04-26 14:31         ` Tom Tromey
2012-04-26 14:42           ` Joel Brobecker
2012-04-27 20:23           ` Maciej W. Rozycki

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=4F99491E.8050605@redhat.com \
    --to=palves@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@codesourcery.com \
    --cc=rdsandiford@googlemail.com \
    /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