From: Doug Evans Date: Tue, 23 Nov 2010 22:25:37 +0000 (+0000) Subject: * lib/gdb.exp (gdb_test_sequence): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b0ecdc2c4eb56daddc8b7299d0d7109594b0fef;p=binutils-gdb.git * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f6c6b438bd8..33eed4c9f4e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-11-23 Doug Evans + + * 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 PR python/12212 diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 109996facac..bd6a9ac42a4 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -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 diff --git a/gdb/testsuite/gdb.server/ext-run.exp b/gdb/testsuite/gdb.server/ext-run.exp index e268a7d97af..79c41affcce 100644 --- a/gdb/testsuite/gdb.server/ext-run.exp +++ b/gdb/testsuite/gdb.server/ext-run.exp @@ -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" } } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 63e68d3e231..ab54c250868 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -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 {