public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Don't use FOOBAR pattern in gdb_test
@ 2019-09-19 17:54 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-09-19 17:54 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e452e88f54624ae55d534c4ae32e0c768cb4b59f
commit e452e88f54624ae55d534c4ae32e0c768cb4b59f
Author: Tom de Vries <tdevries@suse.de>
Date: Thu Sep 19 19:54:15 2019 +0200
[gdb/testsuite] Don't use FOOBAR pattern in gdb_test
If gdb_test is used with fewer than five arguments, then the question_string
defaults to "^FOOBAR$":
...
if [llength $args]==5 {
set question_string [lindex $args 3]
set response_string [lindex $args 4]
} else {
set question_string "^FOOBAR$"
}
...
This can however match "FOOBAR", so perhaps "\$FOOBAR^" would have been a
better choice.
Eliminate the FOOBAR pattern from gdb_test by instead of defining a default
regexp, conditionally appending the regexp matching to a user_code variable.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-19 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern.
Diff:
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/lib/gdb.exp | 28 ++++++++++++++++------------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d5a5309..e86091e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2019-09-19 Tom de Vries <tdevries@suse.de>
+ * lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern.
+
+2019-09-19 Tom de Vries <tdevries@suse.de>
+
* lib/gdbserver-support.exp (gdb_target_cmd): Fix argument passing.
2019-09-19 Tom de Vries <tdevries@suse.de>
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index acbeb01..3a1f053 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1083,24 +1083,28 @@ proc gdb_test { args } {
set command [lindex $args 0]
set pattern [lindex $args 1]
- if [llength $args]==5 {
- set question_string [lindex $args 3]
- set response_string [lindex $args 4]
- } else {
- set question_string "^FOOBAR$"
- }
-
- return [gdb_test_multiple $command $message {
+ set user_code {}
+ lappend user_code {
-re "\[\r\n\]*(?:$pattern)\[\r\n\]+$gdb_prompt $" {
if ![string match "" $message] then {
pass "$message"
}
}
- -re "(${question_string})$" {
- send_gdb "$response_string\n"
- exp_continue
+ }
+
+ if { [llength $args] == 5 } {
+ set question_string [lindex $args 3]
+ set response_string [lindex $args 4]
+ lappend user_code {
+ -re "(${question_string})$" {
+ send_gdb "$response_string\n"
+ exp_continue
+ }
}
- }]
+ }
+
+ set user_code [join $user_code]
+ return [gdb_test_multiple $command $message $user_code]
}
# Return 1 if version MAJOR.MINOR is at least AT_LEAST_MAJOR.AT_LEAST_MINOR.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-19 17:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-19 17:54 [binutils-gdb] [gdb/testsuite] Don't use FOOBAR pattern in gdb_test Tom de Vries
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).