From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <pedro@palves.net>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified)
Date: Wed, 18 May 2022 16:49:57 +0200 [thread overview]
Message-ID: <2a77687e-9817-b048-2a2a-be6b91737ad3@suse.de> (raw)
In-Reply-To: <b4f2c3d4-4f30-dafe-91b0-a70e6d6122be@palves.net>
On 5/18/22 16:13, Pedro Alves wrote:
> On 2022-05-18 13:36, Pedro Alves wrote:
>> On 2022-05-18 13:15, Tom de Vries wrote:
>>> On 5/18/22 13:01, Pedro Alves wrote:
>>>> - if [llength $args]>2 then {
>>>> - set message [lindex $args 2]
>>>> - } else {
>>>> - set message [lindex $args 0]
>>>> + if { $message == "" } {
>>>> + set message $command
>>>> }
>>>
>>> This seems to cause:
>>> ...
>>> PATH: gdb.ada/exec_changed.exp: shell mv /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/first /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/common
>>> PATH: gdb.ada/exec_changed.exp: shell mv /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/common /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/first
>>> PATH: gdb.ada/exec_changed.exp: shell mv /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/second /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/common
>>> PATH: gdb.ada/exec_changed.exp: shell touch /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/common
>>> PATH: gdb.ada/exec_changed.exp: shell touch /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/exec_changed/first
>>> ...
>>> because the interpretation of message "" changed:
>>> ...
>>> gdb_test "shell mv ${binfile} ${common_binfile}" ".*" ""
>>> ...
>>
>> Hmm... Yeah... We could revert most of the changes to gdb_test and just keep the parse_args
>> part. However, IMO the old behavior is a misfeature, though. I think tests should
>> always have a name. E.g., if such a test hits an internal error, what message would
>> be used?
>>
>> The documentation of the option even says that if message is omitted, use the command
>> string as message:
>>
>> # 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.)
>>
>> Also, gdb_test_multiple doesn't a distinction between explicit "" message and
>> not specified message, the only way to end up with an empty message is if command
>> is empty as well. So AFAICS, this change (inadvertently) made gdb_test and
>> gdb_test_multiple behave the same in this respect.
>>
>> So how about we just fix the affected gdb_test invocations?
>
> So I'm diffing testruns from before the patch vs after, and I think the vast
> majority of cases that weren't issuing a pass should do so. With the new
> messages, we now get a ton of DUPLICATEs, which I'm fixing.
>
> However, there are a few spots here and there where we really would prefer to
> not issue a pass, such as when we're testing something in a loop, and we don't
> know how many iterations there will be.
>
Ack. We could do something fancy like this, which would mean not having
to update the msg or rewrite into gdb_test_multiple
...
message_squash {
foreach var [seq 1 20] {
gdb_test <cmd> <pat> <msg>
}
}
...
and get:
...
PASS: <msg> (20x)
...
but perhaps that'll just confusion.
> Instead of going back to how it used to be, I'm thinking of adding a new
> option to gdb_test, "gdb_test -nopass". The advantage of this approach is
> that we always have a message for the FAIL case this way, and, it's more
> explicit. We could fix the "no message for the FAIL case" in the old implementation
> by delaying defaulting message to the command until after the pass case is added
> to user_code. But the explict option still seems better to me, as it let's you
> specify a message different from the command, and only print it on FAIL. The other
> approach would force the message to be the same as the command.
Makes sense to me.
Thanks,
- Tom
next prev parent reply other threads:[~2022-05-18 14:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 19:29 [PATCH 0/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-03-30 19:29 ` [PATCH 1/5] Remove gdb_test questions that GDB doesn't ask Pedro Alves
2022-03-30 19:29 ` [PATCH 2/5] gdb.base/scope.exp: Remove bogus gdb_test questions Pedro Alves
2022-03-30 19:29 ` [PATCH 3/5] Fix bogus gdb_test invocations Pedro Alves
2022-03-30 19:29 ` [PATCH 4/5] Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp Pedro Alves
2022-03-30 19:29 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-04-07 20:31 ` Bruno Larsen
2022-04-08 12:18 ` Pedro Alves
2022-05-17 10:13 ` [PATCH 5/6] gdb.base/skip.exp: Don't abuse gdb_test's question support (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-16 16:01 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Tom Tromey
2022-05-17 11:25 ` Pedro Alves
2022-05-17 22:48 ` Tom Tromey
2022-05-18 11:01 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-18 12:15 ` Tom de Vries
2022-05-18 12:36 ` Pedro Alves
2022-05-18 14:13 ` Pedro Alves
2022-05-18 14:49 ` Tom de Vries [this message]
2022-05-18 20:34 ` Tom Tromey
2022-05-19 12:42 ` Pedro Alves
2022-05-23 10:48 ` Tom de Vries
2022-05-23 12:01 ` Tom de Vries
2022-05-23 12:50 ` [committed][gdb/testsuite] Fix -prompt handling in gdb_test Tom de Vries
2022-05-23 12:53 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-17 11:41 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Simon Marchi
2022-05-17 12:04 ` Pedro Alves
2022-05-16 16:02 ` [PATCH 0/5] " Tom Tromey
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=2a77687e-9817-b048-2a2a-be6b91737ad3@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).