diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | testsuite/lib/stap_run.exp | 12 | ||||
-rw-r--r-- | testsuite/lib/stap_run2.exp | 83 | ||||
-rw-r--r-- | testsuite/systemtap.maps/absentstats.exp | 2 | ||||
-rw-r--r-- | testsuite/systemtap.stress/whitelist.exp | 6 |
5 files changed, 60 insertions, 51 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 5d015651..e43e360f 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2007-05-25 Martin Hunt <hunt@redhat.com> + + * systemtap.samples/lket.exp (cleanfiles): Set timeout inside expect. + * systemtap.maps/absentstats.exp: Set timeout inside expect. + * lib/stap_run2.exp (stap_run2): Set timeout to 180 inside expect. + * lib/stap_run.exp (stap_run): Set timeout to 180 for slower machines. + Remove $ anchor on output. Fix a few minor nits in patterns. + 2007-05-24 David Smith <dsmith@redhat.com> PR4446 diff --git a/testsuite/lib/stap_run.exp b/testsuite/lib/stap_run.exp index baf41d9b..8b1c8eaa 100644 --- a/testsuite/lib/stap_run.exp +++ b/testsuite/lib/stap_run.exp @@ -31,12 +31,13 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args } } eval spawn $cmd expect { - -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} + -timeout 180 + -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms\.\r\n} {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"; exp_continue} - -re {^Pass\ ([34]): using cached .+\r\n} + -re {^Pass\ ([34]): using cached [^\r]+\r\n} {set pass$expect_out(1,string) "\t0\t0\t0"; exp_continue} -re {^Pass 5: starting run.\r\n} {exp_continue} - -timeout 30 -re "^systemtap starting probe\r\n" { + -re "^systemtap starting probe\r\n" { pass "$TEST_NAME startup" if {$LOAD_GEN_FUNCTION != ""} then { #run the interesting test here @@ -50,13 +51,14 @@ proc stap_run { TEST_NAME {LOAD_GEN_FUNCTION ""} {OUTPUT_CHECK_STRING ""} args } send "\003" # check the output to see if it is sane - set output "^systemtap ending probe\r\n$OUTPUT_CHECK_STRING$" + set output "^systemtap ending probe\r\n$OUTPUT_CHECK_STRING" expect { + -timeout 20 -re $output { pass "$TEST_NAME shutdown and output" expect { - -re {^Pass\ ([5]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} + -re {^Pass\ ([5]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms\.\r\n} {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)" verbose -log "metric:\t$TEST_NAME $pass1$pass2$pass3$pass4$pass5"} -re {^WARNING: Number of errors: ([0-9]+), skipped probes: ([0-9]+)\r\n} diff --git a/testsuite/lib/stap_run2.exp b/testsuite/lib/stap_run2.exp index 290f0d84..254b4e5a 100644 --- a/testsuite/lib/stap_run2.exp +++ b/testsuite/lib/stap_run2.exp @@ -8,49 +8,48 @@ # # global result_string must be set to the expected output -set timeout 20 - proc stap_run2 { TEST_NAME args } { - # zap the srcdir prefix - set test_file_name $TEST_NAME - set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""] - - if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return } - - # fix up expected string - regsub -all \n $::result_string \r\n output - - # spawn test - set cmd [concat {stap -v} $args] - if [file readable $test_file_name] { - lappend cmd $test_file_name - } - eval spawn $cmd - - expect { - -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} - {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"; exp_continue} - -re {^Pass\ ([34]): using cached .+\r\n} - {set pass$expect_out(1,string) "\t0\t0\t0"; exp_continue} - -re {^Pass 5: starting run.\r\n} {exp_continue} - -ex $output { - pass "$TEST_NAME" - expect { - -re {^Pass\ ([5]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} - {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)" - verbose -log "metric:\t$TEST_NAME $pass1$pass2$pass3$pass4$pass5"} - } + # zap the srcdir prefix + set test_file_name $TEST_NAME + set TEST_NAME [regsub {.*/testsuite/} $TEST_NAME ""] + + if {[info procs installtest_p] != "" && ![installtest_p]} { untested $TEST_NAME; return } + + # fix up expected string + regsub -all \n $::result_string \r\n output + + # spawn test + set cmd [concat {stap -v} $args] + if [file readable $test_file_name] { + lappend cmd $test_file_name } - timeout { - fail "$TEST_NAME timed out" } - eof { - fail "$TEST_NAME unexpected EOF" } - -re "semantic error:" { fail "$TEST_NAME compilation" } - -re "ERROR:" { - send "\003" - fail "$TEST_NAME runtime error" + eval spawn $cmd + + expect { + -timeout 180 + -re {^Pass\ ([1234]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} + {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)"; exp_continue} + -re {^Pass\ ([34]): using cached .+\r\n} + {set pass$expect_out(1,string) "\t0\t0\t0"; exp_continue} + -re {^Pass 5: starting run.\r\n} {exp_continue} + -ex $output { + pass "$TEST_NAME" + expect { + -re {^Pass\ ([5]):[^\r]*\ in\ ([0-9]+)usr/([0-9]+)sys/([0-9]+)real\ ms.\r\n} + {set pass$expect_out(1,string) "\t$expect_out(2,string)\t$expect_out(3,string)\t$expect_out(4,string)" + verbose -log "metric:\t$TEST_NAME $pass1$pass2$pass3$pass4$pass5"} + } + } + timeout { + fail "$TEST_NAME timed out" } + eof { + fail "$TEST_NAME unexpected EOF" } + -re "semantic error:" { fail "$TEST_NAME compilation" } + -re "ERROR:" { + send "\003" + fail "$TEST_NAME runtime error" + } } - } - catch close - wait + catch close + wait } diff --git a/testsuite/systemtap.maps/absentstats.exp b/testsuite/systemtap.maps/absentstats.exp index 5773e7ae..38cdbd07 100644 --- a/testsuite/systemtap.maps/absentstats.exp +++ b/testsuite/systemtap.maps/absentstats.exp @@ -6,11 +6,11 @@ if {![installtest_p]} { untested $test; return } set ok 0 set ko 0 -set timeout 20 spawn stap -DMAXERRORS=20 $srcdir/$subdir/$test.stp # spawn echo hello children 0 expect { + -timeout 60 -re {^ERROR: empty aggregate[^\r]*\r} { incr ko ; exp_continue } -re {^WARNING: Number of errors} { incr ko ; exp_continue } -re {^0\r} { incr ok ; exp_continue } diff --git a/testsuite/systemtap.stress/whitelist.exp b/testsuite/systemtap.stress/whitelist.exp index fda33a7c..00a8208a 100644 --- a/testsuite/systemtap.stress/whitelist.exp +++ b/testsuite/systemtap.stress/whitelist.exp @@ -301,8 +301,8 @@ proc whitelist_run { TEST_NAME {LOAD_GEN_FUNCTION ""} args } { catch {eval spawn $cmd} set stap_id $spawn_id set failed 1 - set timeout 600 expect { + -timeout 1800 -i $stap_id -re {^Pass\ ([1234]):\ [^\r]*\r\n} { set error_msg "pass$expect_out(1,string)"; exp_continue @@ -313,7 +313,7 @@ proc whitelist_run { TEST_NAME {LOAD_GEN_FUNCTION ""} args } { send -i $stap_id "\003" exp_continue } - -timeout 1800 -re {Pass\ 5:\ run\ completed} { + -re {Pass\ 5:\ run\ completed} { set failed 0 } -re {parse\ error|semantic\ error} { set detail "$expect_out(0,string)" } @@ -327,7 +327,6 @@ proc whitelist_run { TEST_NAME {LOAD_GEN_FUNCTION ""} args } { proc runbenchs {} { global benchs - set timeout 900 set runningcount 0 foreach bench $benchs { @@ -346,6 +345,7 @@ proc runbenchs {} { while {$runningcount > 0} { expect { + -timeout 900 -i $idlist -re {LTP\ Version:\ LTP-([0-9])+\r\n$} { set from $expect_out(spawn_id) lappend benchres($from) $expect_out(buffer) |