diff options
author | Bob Manson <manson@cygnus> | 1997-02-03 03:35:42 +0000 |
---|---|---|
committer | Bob Manson <manson@cygnus> | 1997-02-03 03:35:42 +0000 |
commit | 0d8017baade73f0b3f2681bc52909610f957fa3a (patch) | |
tree | 264f09c2f8e9b5163fa85c98a7c7ca438f1bd088 /gdb/testsuite | |
parent | 85fbaa747f9edd4184cce516c8804bb4553e08f7 (diff) | |
download | gdb-0d8017baade73f0b3f2681bc52909610f957fa3a.zip gdb-0d8017baade73f0b3f2681bc52909610f957fa3a.tar.gz gdb-0d8017baade73f0b3f2681bc52909610f957fa3a.tar.bz2 |
* lib/gdb.exp(gdb_test): Surround the result pattern with
parenthesis in case it contains multiple regexps separated
with |.
Fixes last nights native failures.
* gdb.base/watchpoint.exp: Use gdb_test.
* gdb.base/default.exp: Ditto.
More improvements.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/default.exp | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/watchpoint.exp | 143 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 4 |
4 files changed, 61 insertions, 124 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 477de90..41b8f38 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +Sun Feb 2 00:55:14 1997 Bob Manson <manson@charmed.cygnus.com> + + * lib/gdb.exp(gdb_test): Surround the result pattern with + parenthesis in case it contains multiple regexps separated + with |. + + * gdb.base/watchpoint.exp: Use gdb_test. + * gdb.base/default.exp: Ditto. + Sat Feb 1 23:51:01 1997 Bob Manson <manson@charmed.cygnus.com> * gdb.*/*.exp: Replace $prompt with $gdb_prompt. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 835c506..9f7384e 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -350,13 +350,13 @@ gdb_test "pwd" "Working directory .*" "pwd" #test run "r" abbreviation if [istarget "*-*-vxworks*"] then { - send_gdb "set args\n" - expect -re "$gdb_prompt $" {} + gdb_test "set args" "" "" + gdb_test "r" "Starting program: .* You must specify a function name to run, and arguments if any"\ "run \"r\" abbreviation" - send_gdb "set args main\n" - expect -re "$gdb_prompt $" {} + gdb_test "set args main" "" "" + } else { send_gdb "r\n" expect { @@ -382,12 +382,12 @@ No program loaded.*$gdb_prompt $"\ #test run if [istarget "*-*-vxworks*"] then { - send_gdb "set args\n" - expect -re "$gdb_prompt $" {} + gdb_test "set args" "" "" + gdb_test "run" "Starting program: .* You must specify a function name to run, and arguments if any" - send_gdb "set args main\n" - expect -re "$gdb_prompt $" {} + gdb_test "set args main" "" "" + } else { send_gdb "run\n" expect { @@ -415,17 +415,8 @@ gdb_test "rbreak" "" "rbreak" #test return # The middle case accommodates the a29k, where doing the "ni" above causes # an initial stack to be created. -send_gdb "return\n" -expect { - -re "No selected frame..*$gdb_prompt $"\ - { pass "return" } - -re "Make .* return now.*y or n. $" { - send_gdb "y\n" - exp_continue - } - -re ".*$gdb_prompt $" { fail "return" } - timeout { fail "(timeout) return" } - } +gdb_test "return" "No selected frame..*" "return" "Make .* return now.*y or n. $" "y" + #test reverse-search gdb_test "reverse-search" "No previous regular expression.*|There is no previous regular expression.*" "reverse-search" diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 2b34c41..25308df 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -56,66 +56,42 @@ proc initialize {} { global decimal global srcfile - send_gdb "break marker1\n" - expect { - -re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$gdb_prompt $" { - pass "set breakpoint at marker1" - } - -re ".*$gdb_prompt $" { fail "set breakpoint at marker1" ; return 0 } - timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 } + if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { + return 0; } - send_gdb "break marker2\n" - expect { - -re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$gdb_prompt $" { - pass "set breakpoint at marker2" - } - -re ".*$gdb_prompt $" { fail "set breakpoint at marker2" ; return 0 } - timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 } + + if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] { + return 0; } - send_gdb "info break\n" - expect { - -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$gdb_prompt $" { pass "info break in watchpoint.exp" } - -re ".*$gdb_prompt $" { fail "info break in watchpoint.exp" ; return 0 } - timeout { fail "info break in watchpoint.exp (timeout)" ; return 0 } + + if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break in watchpoint.exp" ] { + return 0; } - send_gdb "watch ival3\n" - expect { - -re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" { - pass "set watchpoint on ival3" - } - -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" ; return 0 } - timeout { fail "set watchpoint on ival3 (timeout)" ; return 0 } + + if [gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3" "set watchpoint on ival3" ] { + return 0; } + # "info watch" is the same as "info break" - send_gdb "info watch\n" - expect { - -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" { - pass "watchpoint found in watchpoint/breakpoint table" - } - -re ".*$gdb_prompt $" { - fail "watchpoint found in watchpoint/breakpoint table" ; return 0 - } - timeout { - fail "watchpoint found in watchpoint/breakpoint table (timeout)" ; return 0 - } + if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { + return 0; } + # After installing the watchpoint, we disable it until we are ready # to use it. This allows the test program to run at full speed until # we get to the first marker function. - send_gdb "disable 3\n" - expect { - -re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" } - -re ".*$gdb_prompt $" { fail "disable watchpoint" ; return 0 } - timeout { fail "disable watchpoint (timeout)" ; return 0 } + if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { + return 0; } + return 1 } @@ -131,21 +107,11 @@ proc test_simple_watchpoint {} { # Ensure that the watchpoint is disabled when we startup. - send_gdb "disable 3\n" - expect { - -re "^disable 3\[\r\n\]+$gdb_prompt $" { - pass "disable watchpoint in test_simple_watchpoint" - } - -re ".*$gdb_prompt $" { - fail "disable watchpoint in test_simple_watchpoint" - return 0 - } - timeout { - fail "disable watchpoint in test_simple_watchpoint (timeout)" - return 0 - } + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { + return 0; } + # Run until we get to the first marker function. gdb_run_cmd @@ -166,13 +132,11 @@ proc test_simple_watchpoint {} { # After reaching the marker function, enable the watchpoint. - send_gdb "enable 3\n" - expect { - -re "^enable 3\[\r\n\]+$gdb_prompt $" { pass "enable watchpoint" } - -re ".*$gdb_prompt $" { fail "enable watchpoint" ; return } - timeout { fail "enable watchpoint (timeout)" ; return } + if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { + return ; } + gdb_test "break func1" "Breakpoint.*at.*" gdb_test "set \$func1_breakpoint_number = \$bpnum" "" @@ -223,13 +187,11 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count # Disable the watchpoint so we run at full speed until we exit. - send_gdb "disable 3\n" - expect { - -re "^disable 3\[\r\n\]+$gdb_prompt $" { pass "watchpoint disabled" } - -re ".*$gdb_prompt $" { fail "watchpoint disabled" ; return } - timeout { fail "watchpoint disabled (timeout)" ; return } + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { + return ; } + # Run until process exits. if $noresults==1 then { return } @@ -250,21 +212,11 @@ proc test_disabling_watchpoints {} { # Ensure that the watchpoint is disabled when we startup. - send_gdb "disable 3\n" - expect { - -re "^disable 3\[\r\n\]+$gdb_prompt $" { - pass "disable watchpoint in test_disabling_watchpoints" - } - -re ".*$gdb_prompt $" { - fail "disable watchpoint in test_disabling_watchpoints" - return 0 - } - timeout { - fail "disable watchpoint in test_disabling_watchpoints (timeout)" - return 0 - } + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { + return 0; } + # Run until we get to the first marker function. gdb_run_cmd @@ -285,13 +237,11 @@ proc test_disabling_watchpoints {} { # After reaching the marker function, enable the watchpoint. - send_gdb "enable 3\n" - expect { - -re "^enable 3\[\r\n\]+$gdb_prompt $" { pass "watchpoint enabled" } - -re ".*$gdb_prompt $" { fail "watchpoint enabled" ; return } - timeout { fail "watchpoint enabled (timeout)" ; return } + if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { + return ; } + # Continue until the first change, from -1 to 0 # Don't check the old value, because on VxWorks the variable value # will not have been reinitialized. @@ -302,21 +252,11 @@ proc test_disabling_watchpoints {} { # Disable the watchpoint but leave breakpoints - send_gdb "disable 3\n" - expect { - -re "^disable 3\[\r\n\]+$gdb_prompt $" { - pass "disable watchpoint #2 in test_disabling_watchpoints" - } - -re ".*$gdb_prompt $" { - "disable watchpoint #2 in test_disabling_watchpoints" - return 0 - } - timeout { - "disable watchpoint #2 in test_disabling_watchpoints (timeout)" - return 0 - } + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] { + return 0; } + # Check watchpoint list, looking for the entry that confirms the # watchpoint is disabled. gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" @@ -382,6 +322,7 @@ proc test_stepping {} { -re "Run.*exit from.*marker1.* at" { } default { fail "finish from marker1" ; return } } + expect { -re "marker1 \\(\\);.*$gdb_prompt $" { send_gdb "step\n" @@ -455,13 +396,10 @@ proc test_watchpoint_triggered_in_syscall {} { # If we send_gdb "123\n" before gdb has switched the tty, then it goes # to gdb, not the inferior, and we lose. So that is why we have # watchpoint.c prompt us, so we can wait for that prompt. - send_gdb "continue\n" - expect { - -re "Continuing\\.\r\ntype stuff for buf now:" { - pass "continue to read" - } - default { fail "continue to read"; return } + if [gdb_test "continue" "Continuing\\.\r\ntype stuff for buf now:" "continue to read" ] { + return ; } + send_gdb "123\n" expect { -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } @@ -552,7 +490,6 @@ proc test_complex_watchpoint {} { # Start with a fresh gdb. -gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index dc203ca..a492004 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -354,13 +354,13 @@ proc gdb_test { args } { gdb_start set result -1 } - -re "\[\r\n\]*$pattern\[\r\n\]+$gdb_prompt $" { + -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" { if ![string match "" $message] then { pass "$message" } set result 0 } - -re "${question_string}$" { + -re "(${question_string})$" { send_gdb "$response_string\n"; exp_continue; } |