From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix test name in gdb.base/batch-exit-status.exp
Date: Mon, 13 Sep 2021 09:18:28 +0200 [thread overview]
Message-ID: <20210913071826.GA3402@delia.home> (raw)
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
...
The mistake is that I passed an output regexp argument to a parameter
interpreted as testname prefix. Fix this by passing a testname prefix
instead.
Add support for checking output, to be able to handle the output regexp
argument.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Fix test name in gdb.base/batch-exit-status.exp
---
gdb/testsuite/gdb.base/batch-exit-status.exp | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
index 9a080196bd6..520083f7989 100644
--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
@@ -20,7 +20,7 @@ standard_testfile
set good_commands "$srcdir/$subdir/batch-exit-status.good-commands"
set bad_commands "$srcdir/$subdir/batch-exit-status.bad-commands"
-proc _test_exit_status {expect_status cmdline_opts} {
+proc _test_exit_status {expect_status cmdline_opts {re ""}} {
global gdb_spawn_id
gdb_exit
@@ -29,7 +29,16 @@ proc _test_exit_status {expect_status cmdline_opts} {
return
}
+ set has_re [expr ![string equal $re ""]]
+ if { ! $has_re } {
+ set re "\$FOOBAR^"
+ }
+ set re_matched 0
gdb_test_multiple "" "run til exit" {
+ -re $re {
+ set re_matched 1
+ exp_continue
+ }
eof {
set result [wait -i $gdb_spawn_id]
verbose $result
@@ -41,15 +50,18 @@ proc _test_exit_status {expect_status cmdline_opts} {
clear_gdb_spawn_id
}
}
+ if { $has_re } {
+ gdb_assert { $re_matched } "output matched"
+ }
}
-proc test_exit_status {expect_status cmdline_opts prefix} {
+proc test_exit_status {expect_status cmdline_opts prefix args} {
if { $prefix == "" } {
set prefix $cmdline_opts
}
with_test_prefix $prefix {
- _test_exit_status $expect_status $cmdline_opts
+ _test_exit_status $expect_status $cmdline_opts {*}$args
}
}
@@ -77,6 +89,8 @@ test_exit_status 1 "-batch -x $good_commands -x $bad_commands" \
test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" \
"-batch -x good-commands -ex \"set not-a-thing 4\""
-set no_such_re ": No such file or directory\\."
-test_exit_status 1 "-batch \"\"" $no_such_re
-test_exit_status 1 "-batch \"\" \"\"" [multi_line $no_such_re $no_such_re]
+set test "No such file or directory"
+set no_such_re ": $test\\."
+test_exit_status 1 "-batch \"\"" "1x: $test" ^[multi_line $no_such_re ""]$
+test_exit_status 1 "-batch \"\" \"\"" "2x: $test" \
+ ^[multi_line $no_such_re $no_such_re ""]$
reply other threads:[~2021-09-13 7:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210913071826.GA3402@delia.home \
--to=tdevries@suse.de \
--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).