* lib/gdb.exp (gdb_test_sequence): New function.

(gdb_expect_list): Add verbose -log call for each pattern.
	* gdb.base/signals.exp (test_handle_all_print): Call it.
	Reduce timeout increment from 6 minutes to 1 minute.
	* gdb.server/ext-run.exp: Call it.
This commit is contained in:
Doug Evans 2010-11-23 22:25:37 +00:00
parent 435b94a4ae
commit 6b0ecdc2c4
4 changed files with 50 additions and 18 deletions

View file

@ -1,3 +1,11 @@
2010-11-23 Doug Evans <dje@google.com>
* lib/gdb.exp (gdb_test_sequence): New function.
(gdb_expect_list): Add verbose -log call for each pattern.
* gdb.base/signals.exp (test_handle_all_print): Call it.
Reduce timeout increment from 6 minutes to 1 minute.
* gdb.server/ext-run.exp: Call it.
2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
PR python/12212

View file

@ -56,14 +56,23 @@ proc test_handle_all_print {} {
# Increase timeout and expect input buffer for large output from gdb.
# Allow blank or TAB as whitespace characters.
set oldtimeout $timeout
set timeout [expr "$timeout + 360"]
set timeout [expr "$timeout + 60"]
verbose "Timeout is now $timeout seconds" 2
if { ![istarget "*-*-linux*"]
&& ( [istarget "*-*-gnu*"]
|| [istarget "*-*-mach*"] ) } {
gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63.*EXC_BREAKPOINT\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Breakpoint"
gdb_test_sequence "handle all print" "" \
{
"Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup"
"SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63"
"EXC_BREAKPOINT\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Breakpoint"
}
} else {
gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63.*"
gdb_test_sequence "handle all print" "" \
{
"Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup"
"SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63"
}
}
set timeout $oldtimeout
verbose "Timeout restored to $timeout seconds" 2

View file

@ -53,21 +53,9 @@ if { [istarget *-*-linux*] } {
# But only if xml support is compiled in.
if { $do_xml_test } {
# This is done in a way to avoid the timeout that can occur from
# applying .* regexp to large output. It is copied from
# gdb.base/maint.exp "maint check-symtabs".
send_gdb "info os processes\n"
gdb_expect {
-re ".*pid +user +command.*1 +root +\[/a-z\]*init" {
gdb_expect {
-re "$gdb_prompt $" {
pass "get process list"
}
timeout { fail "(timeout) get process list" }
}
}
-re ".*$gdb_prompt $" { fail "get process list" }
timeout { fail "(timeout) get process list" }
}
# applying .* regexp to large output.
gdb_test_sequence "info os processes" "get process list" \
{ "pid +user +command" "1 +root +\[/a-z\]*init" }
}
}

View file

@ -921,6 +921,32 @@ proc gdb_test_no_output { args } {
}
}
# Send a command and then wait for a sequence of outputs.
# This is useful when the sequence is long and contains ".*", a single
# regexp to match the entire output can get a timeout much easier.
#
# COMMAND is the command to send.
# TEST_NAME is passed to pass/fail. COMMAND is used if TEST_NAME is "".
# EXPECTED_OUTPUT_LIST is a list of regexps of expected output, which are
# processed in order, and all must be present in the output.
#
# It is unnecessary to specify ".*" at the beginning or end of any regexp,
# there is an implicit ".*" between each element of EXPECTED_OUTPUT_LIST.
# There is also an implicit ".*" between the last regexp and the gdb prompt.
#
# Like gdb_test and gdb_test_multiple, the output is expected to end with the
# gdb prompt, which must not be specified in EXPECTED_OUTPUT_LIST.
proc gdb_test_sequence { command test_name expected_output_list } {
global gdb_prompt
if { $test_name == "" } {
set test_name $command
}
lappend expected_output_list ""; # implicit ".*" before gdb prompt
send_gdb "$command\n"
gdb_expect_list $test_name "$gdb_prompt $" $expected_output_list
}
# Test that a command gives an error. For pass or fail, return
# a 1 to indicate that more tests can proceed. However a timeout
@ -2375,6 +2401,7 @@ proc gdb_expect_list {test sentinel list} {
while { ${index} < [llength ${list}] } {
set pattern [lindex ${list} ${index}]
set index [expr ${index} + 1]
verbose -log "gdb_expect_list pattern: /$pattern/" 2
if { ${index} == [llength ${list}] } {
if { ${ok} } {
gdb_expect {