* [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
@ 2010-05-25 21:43 Michael Snyder
2010-05-26 18:04 ` Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2010-05-25 21:43 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: gdb.exp.txt --]
[-- Type: text/plain, Size: 12678 bytes --]
2010-05-25 Michael Snyder <msnyder@vmware.com>
* gdb.gdb/complaints.exp: Replace send_gdb with gdb_test.
* gdb.gdb/selftest.exp: Replace send_gdb with gdb_test.
* gdb.gdb/xfullpath.exp: Replace send_gdb with gdb_test.
Index: complaints.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/complaints.exp,v
retrieving revision 1.12
diff -u -p -r1.12 complaints.exp
--- complaints.exp 5 May 2010 18:07:00 -0000 1.12
+++ complaints.exp 25 May 2010 20:35:19 -0000
@@ -72,8 +72,7 @@ proc setup_test { executable } {
set timeout 600
set description "run until breakpoint at captured_command_loop"
- send_gdb "run -nw\n"
- gdb_expect {
+ gdb_test_multiple "run -nw" "$description" {
-re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" {
pass "$description"
}
@@ -92,9 +91,6 @@ proc setup_test { executable } {
verbose "Timeout is now $timeout seconds" 2
return -1
}
- timeout {
- fail "$description (timeout)"
- }
}
set timeout $oldtimeout
@@ -140,44 +136,23 @@ proc test_serial_complaints { } {
gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start"
# Prime the system
- send_gdb "call complaint (&symfile_complaints, \"serial line 1\")\n"
- gdb_expect {
- -re "During symbol reading...serial line 1...$gdb_prompt " {
+ gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 1\")" "serial line 1" {
+ -re "During symbol reading...serial line 1...$gdb_prompt $" {
pass "serial line 1"
}
- "$gdb_prompt" {
- fail "serial line 1"
- }
- timeout {
- fail "serial line 1 (timeout)"
- }
}
# Add a second complaint, expect it
- send_gdb "call complaint (&symfile_complaints, \"serial line 2\")\n"
- gdb_expect {
+ gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" {
-re "serial line 2...$gdb_prompt " {
pass "serial line 2"
}
- "$gdb_prompt" {
- fail "serial line 2"
- }
- timeout {
- fail "serial line 2 (timeout)"
- }
}
- send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n"
- gdb_expect {
+ gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" {
-re "\r\n\r\n$gdb_prompt " {
pass "serial end"
}
- "$gdb_prompt" {
- fail "serial end"
- }
- timeout {
- fail "serial end (timeout)"
- }
}
return 0
@@ -192,44 +167,23 @@ proc test_short_complaints { } {
gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start"
# Prime the system
- send_gdb "call complaint (&symfile_complaints, \"short line 1\")\n"
- gdb_expect {
+ gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" {
-re "short line 1...$gdb_prompt " {
pass "short line 1"
}
- "$gdb_prompt" {
- fail "short line 1"
- }
- timeout {
- fail "short line 1 (timeout)"
- }
}
# Add a second complaint, expect it
- send_gdb "call complaint (&symfile_complaints, \"short line 2\")\n"
- gdb_expect {
+ gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" {
-re "short line 2...$gdb_prompt " {
pass "short line 2"
}
- "$gdb_prompt" {
- fail "short line 2"
- }
- timeout {
- fail "short line 2 (timeout)"
- }
}
- send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n"
- gdb_expect {
+ gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" {
-re "\r\n\r\n$gdb_prompt " {
pass "short end"
}
- "$gdb_prompt" {
- fail "short end"
- }
- timeout {
- fail "short end (timeout)"
- }
}
return 0
@@ -241,19 +195,14 @@ proc test_short_complaints { } {
proc test_empty_complaint { cmd msg } {
global gdb_prompt
- send_gdb $cmd
- gdb_expect {
- -re "\r\n\r\n$gdb_prompt " {
+ gdb_test_multiple $cmd $msg {
+ -re "\r\n\r\n$gdb_prompt $" {
fail $msg
}
- "\r\n$gdb_prompt" {
+ "\r\n$gdb_prompt $" {
pass $msg
}
- timeout {
- fail "$msg (timeout)"
- }
}
-
}
proc test_empty_complaints { } {
Index: selftest.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/selftest.exp,v
retrieving revision 1.19
diff -u -p -r1.19 selftest.exp
--- selftest.exp 5 May 2010 18:07:00 -0000 1.19
+++ selftest.exp 25 May 2010 20:35:19 -0000
@@ -39,12 +39,11 @@ proc do_steps_and_nexts {} {
set unlikely_line 0
for {set count 0} {$count < 32} {incr count} {
- send_gdb "list\n"
# NOTE: carlton/2002-12-11: The "initial brace" and
# "current_directory initialization" possibilities happen to
# me with GCC 3.1 on i686-pc-linux-gnu when I compile with
# optimization.
- gdb_expect {
+ gdb_test_multiple "list" "list" {
-re ".*context = data.*$gdb_prompt $" {
set description "step over context initialization"
set command "step"
@@ -227,8 +226,7 @@ proc do_steps_and_nexts {} {
return
}
}
- send_gdb "$command\n"
- gdb_expect {
+ gdb_test_multiple "$command" "$description" {
-re ".*No such file or directory.\r\n$gdb_prompt $" {
fail "$description (no source available)"
}
@@ -238,9 +236,6 @@ proc do_steps_and_nexts {} {
-re ".*$gdb_prompt $" {
pass "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
}
}
@@ -312,8 +307,7 @@ proc test_with_self { executable } {
set timeout 600
set description "run until breakpoint at captured_main"
- send_gdb "run -nw\n"
- gdb_expect {
+ gdb_test_multiple "run -nw" "$description" {
-re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
pass "$description"
}
@@ -332,17 +326,13 @@ proc test_with_self { executable } {
verbose "Timeout is now $timeout seconds" 2
return -1
}
- timeout {
- fail "$description (timeout)"
- }
}
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
# do we have a version number ?
- send_gdb "print version\n"
- gdb_expect {
+ gdb_test_multiple "print version" "printed version" {
-re ".\[0-9\]+ = .\[0-9.\]+.*$gdb_prompt $" {
pass "printed version as string"
}
@@ -352,8 +342,6 @@ proc test_with_self { executable } {
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
- -re ".*$gdb_prompt $" { fail "printed version" }
- timeout { fail "(timeout) printed version" }
}
do_steps_and_nexts
@@ -370,8 +358,7 @@ proc test_with_self { executable } {
set stepped_back 0
setup_xfail "alpha-*-*" "mips-*-*"
set description "step into xmalloc call"
- send_gdb "step\n"
- gdb_expect {
+ gdb_test_multiple "step" "$description" {
-re "ncmd = 0;.*$gdb_prompt $" {
set stepped_back 1
send_gdb "step\n"
@@ -404,48 +391,26 @@ proc test_with_self { executable } {
-re "A file or directory .* does not exist..\r\n$gdb_prompt $" {
pass "$description (no source available)"
}
- -re ".*$gdb_prompt $" {
- fail "$description"
- }
- timeout {
- fail "$description (timeout)"
- }
}
# start the "xgdb" process
- send_gdb "continue\n"
- gdb_expect {
- -re "GNU gdb \[0-9\.\]*.*
-Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*
-License GPLv3\\+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.*
-This is free software: you are free to change and redistribute it.*
-There is NO WARRANTY, to the extent permitted by law. Type \"show copying\".*
-and \"show warranty\" for details.*
-This GDB was configured as .*$gdb_prompt $"\
- { pass "xgdb is at prompt" }
- -re "GNU gdb \[0-9\.\]*.*
-Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*
-GDB is free software, covered by the GNU General Public License, and you are.*
-welcome to change it and/or distribute copies of it under certain conditions.*
-Type \"show copying\" to see the conditions.*
-There is absolutely no warranty for GDB. Type \"show warranty\" for details.*
-This GDB was configured as .*$gdb_prompt $"\
- { pass "xgdb is at prompt (obsolescent gdb 2)" }
- -re "GDB is free software and you are welcome to distribute copies of it.*
- under certain conditions; type \"show copying\" to see the conditions..*
-There is absolutely no warranty for GDB; type \"show warranty\" for details..*
-GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
- { pass "xgdb is at prompt (obsolescent gdb 1)" }
- -re ".*$gdb_prompt $" { fail "xgdb is at prompt" }
- timeout { fail "(timeout) xgdb is at prompt" }
+ gdb_test_multiple "continue" "xgdb is at prompt" {
+ -re "GNU gdb \[0-9\.\]*.*Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*License GPLv3\\+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.*This is free software: you are free to change and redistribute it.*There is NO WARRANTY, to the extent permitted by law. Type \"show copying\".*and \"show warranty\" for details.*This GDB was configured as .*$gdb_prompt $" {
+ pass "xgdb is at prompt"
+ }
+ -re "GNU gdb \[0-9\.\]*.*Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*GDB is free software, covered by the GNU General Public License, and you are.*welcome to change it and/or distribute copies of it under certain conditions.*Type \"show copying\" to see the conditions.*There is absolutely no warranty for GDB. Type \"show warranty\" for details.*This GDB was configured as .*$gdb_prompt $" {
+ pass "xgdb is at prompt (obsolescent gdb 2)"
+ }
+ -re "GDB is free software and you are welcome to distribute copies of it.* under certain conditions; type \"show copying\" to see the conditions..*There is absolutely no warranty for GDB; type \"show warranty\" for details..*GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $" {
+ pass "xgdb is at prompt (obsolescent gdb 1)"
+ }
}
# set xgdb prompt so we can tell which is which
- send_gdb "set prompt (xgdb) \n"
- gdb_expect {
- -re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" { pass "Set xgdb prompt" }
- -re ".*$gdb_prompt $" { fail "Set xgdb prompt" }
- default { fail "(timeout) Set xgdb prompt" }
+ gdb_test_multiple "set prompt (xgdb) " "Set xgdb_prompt" {
+ -re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" {
+ pass "Set xgdb prompt"
+ }
}
# kill the xgdb process
@@ -464,18 +429,9 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
}
set description "send SIGINT signal to child process"
- send_gdb "signal SIGINT\n"
- gdb_expect {
- -re "Continuing with signal SIGINT.*$gdb_prompt $" {
- pass "$description"
- }
- -re ".*$gdb_prompt $" {
- fail "$description"
- }
- timeout {
- fail "$description (timeout)"
- }
- }
+ gdb_test "signal SIGINT" \
+ "Continuing with signal SIGINT.*" \
+ "$description"
# get a stack trace
#
@@ -484,8 +440,7 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
# The testsuite failures may not be limited to just aout systems.
setup_xfail "i*86-pc-linuxaout-gnu"
set description "backtrace through signal handler"
- send_gdb "backtrace\n"
- gdb_expect {
+ gdb_test_multiple "backtrace" "$description" {
-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
@@ -498,9 +453,6 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
Index: xfullpath.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/xfullpath.exp,v
retrieving revision 1.12
diff -u -p -r1.12 xfullpath.exp
--- xfullpath.exp 5 May 2010 18:07:00 -0000 1.12
+++ xfullpath.exp 25 May 2010 20:35:19 -0000
@@ -72,8 +72,7 @@ proc setup_test { executable } {
set timeout 600
set description "run until breakpoint at captured_main"
- send_gdb "run -nw\n"
- gdb_expect {
+ gdb_test_multiple "run -nw" "$description" {
-re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
pass "$description"
}
@@ -92,9 +91,6 @@ proc setup_test { executable } {
verbose "Timeout is now $timeout seconds" 2
return -1
}
- timeout {
- fail "$description (timeout)"
- }
}
set timeout $oldtimeout
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
2010-05-25 21:43 [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test Michael Snyder
@ 2010-05-26 18:04 ` Joel Brobecker
2010-05-26 18:26 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2010-05-26 18:04 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> 2010-05-25 Michael Snyder <msnyder@vmware.com>
>
> * gdb.gdb/complaints.exp: Replace send_gdb with gdb_test.
> * gdb.gdb/selftest.exp: Replace send_gdb with gdb_test.
> * gdb.gdb/xfullpath.exp: Replace send_gdb with gdb_test.
Same question as before: Can you double-check that gdb_test cannot
be used in the cases below? If not, OK to commit.
> # Add a second complaint, expect it
> - send_gdb "call complaint (&symfile_complaints, \"serial line 2\")\n"
> - gdb_expect {
> + gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" {
> -re "serial line 2...$gdb_prompt " {
> pass "serial line 2"
> }
> - "$gdb_prompt" {
> - fail "serial line 2"
> - }
> - timeout {
> - fail "serial line 2 (timeout)"
> - }
Can we use gdb_test here?
> - send_gdb "call complaint (&symfile_complaints, \"short line 1\")\n"
> - gdb_expect {
> + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" {
> -re "short line 1...$gdb_prompt " {
> pass "short line 1"
Ditto?
> # Add a second complaint, expect it
> - send_gdb "call complaint (&symfile_complaints, \"short line 2\")\n"
> - gdb_expect {
> + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" {
Ditto again.
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
2010-05-26 18:04 ` Joel Brobecker
@ 2010-05-26 18:26 ` Michael Snyder
2010-05-26 18:28 ` Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2010-05-26 18:26 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel Brobecker wrote:
>> 2010-05-25 Michael Snyder <msnyder@vmware.com>
>>
>> * gdb.gdb/complaints.exp: Replace send_gdb with gdb_test.
>> * gdb.gdb/selftest.exp: Replace send_gdb with gdb_test.
>> * gdb.gdb/xfullpath.exp: Replace send_gdb with gdb_test.
>
> Same question as before: Can you double-check that gdb_test cannot
> be used in the cases below? If not, OK to commit.
>
>> # Add a second complaint, expect it
>> - send_gdb "call complaint (&symfile_complaints, \"serial line 2\")\n"
>> - gdb_expect {
>> + gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" {
>> -re "serial line 2...$gdb_prompt " {
Can't use gdb_test because the usual CR/LF are missing from in front of
$gdb_prompt.
>> pass "serial line 2"
>> }
>> - "$gdb_prompt" {
>> - fail "serial line 2"
>> - }
>> - timeout {
>> - fail "serial line 2 (timeout)"
>> - }
>
> Can we use gdb_test here?
>
>> - send_gdb "call complaint (&symfile_complaints, \"short line 1\")\n"
>> - gdb_expect {
>> + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" {
>> -re "short line 1...$gdb_prompt " {
Ditto.
>> pass "short line 1"
>
> Ditto?
>
>> # Add a second complaint, expect it
>> - send_gdb "call complaint (&symfile_complaints, \"short line 2\")\n"
>> - gdb_expect {
>> + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" {
>
> Ditto again.
Ditto again.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
2010-05-26 18:26 ` Michael Snyder
@ 2010-05-26 18:28 ` Joel Brobecker
2010-05-26 18:44 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2010-05-26 18:28 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> Can't use gdb_test because the usual CR/LF are missing from in front
> of $gdb_prompt.
I'm definitely learning about details, today...
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
2010-05-26 18:28 ` Joel Brobecker
@ 2010-05-26 18:44 ` Michael Snyder
2010-05-26 18:45 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2010-05-26 18:44 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel Brobecker wrote:
>> Can't use gdb_test because the usual CR/LF are missing from in front
>> of $gdb_prompt.
>
> I'm definitely learning about details, today...
Me too baby...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test
2010-05-26 18:44 ` Michael Snyder
@ 2010-05-26 18:45 ` Michael Snyder
0 siblings, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2010-05-26 18:45 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Committed
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-26 18:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-25 21:43 [RFA] gdb.gdb/*.exp send_gdb vs. gdb_test Michael Snyder
2010-05-26 18:04 ` Joel Brobecker
2010-05-26 18:26 ` Michael Snyder
2010-05-26 18:28 ` Joel Brobecker
2010-05-26 18:44 ` Michael Snyder
2010-05-26 18:45 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox