-re "compilation failed" {incr compile_errors 1; exp_continue}
-re "semantic error:" {incr compile_errors 1; exp_continue}
}
- set res [wait -i $spawn_id]
catch close
+ set res [wait -i $spawn_id]
set res [lindex $res 3]
if {($res == 0 && $compile_errors == 0)
set res 0
set listRes 1
while { $listRes != 0 && $waited < 15 } {
- exec sleep 1
+ catch exec sleep 1
incr waited
set res [catch { exec stap --list-servers=online,trusted,compatible >& stap-list-servers.out } seen_servers]
set listRes [catch { exec grep "^ host" stap-list-servers.out } looksee]
-re {[^\r\n]*\r\n} { exp_continue }
eof { }
}
+ catch { close }
set results [wait]
verbose -log "wait results: $results"
if {[llength $results] >= 5} {
}
set test "stap-tcl.stp compilation"
-verbose -log "spawn stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so"
+verbose -log "stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so"
set rc [catch {exec stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so} out]
clone_output $out
if {$rc != 0} {
eof { verbose -log "EOF" }
timeout { verbose -log "TIMEOUT" }
}
+ catch { close }
set results [wait]
verbose -log "wait results: $results"
return $alternatives_found
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$errs == 1} {
pass "$test ($errs)"
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 1 && $errs == 0} {
pass "$test (cuname: $ok, $errs)"
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 1} {
pass "$test"
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 1 && $logs == 2} {
pass "$test ($ok, $logs)"
}
}
}
+catch { close }; catch { wait }
if {$status == 1} {pass ${test}1} else {fail ${test}1}
set status 0
}
}
}
+catch { close }; catch { wait }
if {$status == 1} {pass ${test}2} else {fail ${test}2}
set status 0
}
}
}
+catch { close }; catch { wait }
if {$status == 1} {pass ${test}3} else {fail ${test}3}
# cleanup
eof { }
timeout { fail "$test (timeout)" }
}
-catch { close }; wait
+catch { close }; catch { wait }
if {$ok == 3 && $ok2 >= $ok} then { pass "$test ($ok $ok2)" } else { fail "$test ($ok $ok2)" }
eof { }
timeout { fail "$test (timeout)" }
}
-catch { close }; wait
+catch { close }; catch { wait }
if {$ok == 3 && $ok2 >= $ok} then { pass "$test ($ok $ok2)" } else { fail "$test ($ok $ok2)" }
set test "self-unwind-ensure-exact"
eof { }
timeout { fail "$test (timeout)" }
}
-catch { close }; wait
+catch { close }; catch { wait }
if {$ok == 0} then { pass "$test ($ok)" } else { fail "$test ($ok)" }
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 3} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
exec rm -f $test
for {set x 0} {$x<20} {incr x} {
verbose -log "Attempt no. ${x} to crash the kernel..."
spawn stap -ge "probe netfilter.ipv4.local_in { \$verdict = nf_drop; exit() }" -c "ping -qfc 1000 127.0.0.1"
- wait
+ catch { close }; catch { wait }
}
# If the kernel didn't crash, the testcase succeeded.
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 1} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok > 0 && $ko == 0} then { pass "$test" } else { fail "$test $ok $ko" }
timeout { fail "$test (timeout)" }
}
-catch close
-wait
+catch { close }; catch { wait }
# Set a small interval to insure the next stap call cleans the cache
exec /bin/echo 1 > $local_systemtap_dir/cache/cache_clean_interval_s
timeout { fail "$test (timeout)" }
}
-catch close
-wait
+catch { close }; catch { wait }
# Cleanup.
exec /bin/rm -rf $local_systemtap_dir
timeout {fail "cmd_parse1: unexpected timeout"}
eof {fail "cmd_parse1: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {echo "hello "\"world\"} -we {probe begin {}}
expect {
timeout {fail "cmd_parse2: unexpected timeout"}
eof {fail "cmd_parse2: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {sh -c '(a="hello world"; echo $a)'} -we {probe begin {}}
expect {
timeout {fail "cmd_parse3: unexpected timeout"}
eof {fail "cmd_parse3: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {sh -c '(a="hello "\"world\"; echo $a)'} -we {probe begin {}}
expect {
timeout {fail "cmd_parse4: unexpected timeout"}
eof {fail "cmd_parse4: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {sh -c '(a="hello "world; echo $a)'} -we {probe begin {}}
expect {
timeout {fail "cmd_parse5: unexpected timeout"}
eof {fail "cmd_parse5: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {bash -c '((a=42+7)); echo "The answer is $a"'} -we {probe begin {}}
expect {
timeout {fail "cmd_parse6: unexpected timeout"}
eof {fail "cmd_parse6: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -c {sh -c '(echo "Hello World" 1>&2) > /dev/null'} -we {probe begin {}}
expect {
timeout {fail "cmd_parse7: unexpected timeout"}
eof {fail "cmd_parse7: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
# slow test case; requires kernel tracepoint query modules
spawn stap -l {vm.*}
timeout {fail "cmd_parse8: unexpected timeout"}
eof {fail "cmd_parse8: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 1
expect {
timeout { fail "cmd_parse9 timeout" }
eof { fail "cmd_parse9 eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 5 a b c d
expect {
timeout { fail "cmd_parse10 timeout" }
eof { fail "cmd_parse10 eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[$1]) exit() }} 10 a b c d
expect {
timeout { fail "cmd_parse11 timeout" }
eof { fail "cmd_parse11 eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -e {probe begin { printf("%d %s\n", argc, argv[0]) exit() }}
expect {
timeout { fail "cmd_parse12 timeout" }
eof { fail "cmd_parse12 eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
spawn stap -L syscall.a*
expect {
timeout {fail "cmd_parse13: unexpected timeout"}
eof {fail "cmd_parse13: unexpected EOF"}
}
-wait;catch {close}
+catch { close }; catch { wait }
if {![catch { exec sh -c "stap -v -v --vp 01020 -h 2>&1 | grep -q 'add per-pass verbosity .23242.'" }]} {
pass "cmd_parse14"
timeout { fail "cmd_parse15: timeout" }
eof { fail "cmd_parse15: eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
set uname [exec uname -i]
# normalize arch
timeout { fail "cmd_parse16: timeout" }
eof { fail "cmd_parse16: eof" }
}
-wait;catch {close}
+catch { close }; catch { wait }
# NB: when adding extra tests here, increment the ![installtest_p]
# loop count too at the top.
-re {^[^\n\r]+\r\n}
{exp_continue}
}
+catch { close }; catch { wait }
if {$tst == 1} {
pass "$test (non-guru)"
} else {
timeout { fail "$test - testlog.stp timeout" }
timeout { fail "$test - testlog.stp eof" }
}
-catch { kill -INT -[exp_pid] 2; close ; wait }
+catch { kill -INT -[exp_pid] 2 }; catch { close }; catch { wait }
# The crash(8) script creates testlog/global or testlog/cpu<n>
as_root { chmod -R a+rX testlog }
timeout { fail "$test (timeout1)" }
eof { fail "$test (eof)" }
}
-
-wait
+catch { close }; catch { wait }
set test "debugpath-good"
set uname [exec /bin/uname -r]
timeout { fail "$test (timeout2)" }
eof { fail "$test (eof)" }
}
-
-wait
+catch { close }; catch { wait }
eof { }
timeout { }
}
-wait
+catch { close }; catch { wait }
if {$neg > 0} { pass "$test ($pos $neg)" } else { fail "$test ($pos $neg)" }
# run stapio in background mode
spawn stap -F -o $test.out -we {probe begin {}}
+set stap_id $spawn_id
# check whether stap outputs stapio pid
set pid 0
expect {
timeout { fail "$test (timeout)" }
eof { }
}
-wait; catch {close}
+# Notice we call close/wait at the end of the test.
if {$pid == 0} {
fail "$test (no pid)"
return -1
timeout { fail "$test (timeout)"}
eof { fail "$test (stapio was not found)" }
}
-wait; catch {close}
+catch { close -i $spawn_id }; catch { wait -i $spawn_id }
# switch file
exec sleep 2
}
kill -TERM $pid
+catch { close -i $stap_id }; catch { wait -i $stap_id }
# check switched output file
if {[catch {exec rm $test.out.1}]} {
set pid 0
# check -S option
spawn stap -F -o flightlog.out -S 1,3 $srcdir/$subdir/$test.stp
+set stap_id $spawn_id
expect {
-timeout 240
-re {([0-9]+)\r\n} {
timeout { fail "$test (timeout)"}
eof { }
}
-wait; catch {close}
+# Notice we call close/wait at the end of this test.
if {$pid == 0} {
fail "$test (no pid)"
return -1
exec sleep 4
set scnt 0
set cnt1 0
+
# wait for log files
eval spawn stat -c %s [glob flightlog.out.*]
expect {
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
-wait; catch {close}
+catch { close -i $spawn_id }; catch { wait -i $spawn_id }
exec sleep 3
set cnt2 0
+
# wait for log files
eval spawn stat -c %s [glob flightlog.out.*]
expect {
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
-wait; catch {close}
+catch { close -i $spawn_id }; catch { wait -i $spawn_id }
+
# check logfile number
if {$cnt1 == 3 && $cnt2 == 3} {
pass "$test (log file numbers limitation)"
} else {
fail "$test (log file numbers ($cnt1, $cnt2))"
}
+
# check logfile size
if {$scnt == $cnt1 + $cnt2 } {
pass "$test (log file size limitation)"
} else {
fail "$test (log file size ($scnt != $cnt1 + $cnt2))"
}
+
kill -TERM $pid
# wait for exiting...
+catch { close -i $stap_id }; catch { wait -i $stap_id }
exec sleep 1
system "rm -f flightlog.out*"
set pid 0
# check -S option with bulk(percpu file) mode
catch {spawn stap -F -o flightlog.out -S 1,3 -b $srcdir/$subdir/$test.stp}
+set stap_id $spawn_id
expect {
-timeout 240
-re {([0-9]+)\r\n} {
timeout { fail "$test (timeout)"}
eof { }
}
-wait; catch {close}
+# Notice we call close/wait at the end of this test.
if {$pid == 0} {
fail "$test (no pid)"
return -1
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
-wait; catch {close}
+catch { close -i $spawn_id }; catch { wait -i $spawn_id }
kill -CONT $pid
exec sleep 3
kill -STOP $pid
+
catch {eval spawn stat -c \"%n %s\" [glob -nocomplain flightlog.out_cpu*]}
expect {
-timeout 100
exp_continue}
timeout { fail "$test (logfile timeout)"}
}
-wait; catch {close}
+catch { close -i $spawn_id }; catch { wait -i $spawn_id }
kill -CONT $pid
# check logfile number
set cnt 0
}
kill -TERM $pid 5
# wait for exiting...
+catch { close -i $stap_id }; catch { wait -i $stap_id }
exec sleep 1
catch {system "rm -f flightlog.out*"}
timeout { fail "$test (timeout)" }
eof { }
}
-wait; catch {close}
+# Notice we call close/wait at the end of this test.
+
if {$pid == 0} {
fail "$test (no pid)"
return -1
}
kill -TERM $pid 5
+catch { close }; catch { wait }
# check switched output file
if {[catch {exec rm $test.out.2 $test.out.3}]} {
timeout { fail "$test (timeout)" }
eof { }
}
-wait; catch {close}
+# Notice we call close/wait at the end of the test.
if {$pid == 0} {
fail "$test (no pid)"
return -1
exec sleep 2
kill -TERM $pid 5
+catch { close }; catch { wait }
# check switched output file
exec sleep 2
}
eof { if {$match == 0} { fail $subtest } }
}
- wait
+ catch { close }; catch { wait }
}
proc run_one_test {flags bits} {
set passed 1
}
}
+catch { close }; catch { wait }
if {$passed == 1} {
pass $test
expect {
-re {process\([a-z\/\"]+\)*} { incr results 1; exp_continue}
}
-set res [wait -i $spawn_id]
catch close
+set res [wait -i $spawn_id]
set res [lindex $res 3]
if {$res == 0 && $results == 4} {
set secondpid [exp_pid -i $secondid]
kill -INT $firstpid
kill -INT $secondpid
-catch { wait -i $firstid; wait -i $secondid; close }
+catch { close -i $firstid }; catch { wait -i $firstid };
+catch { close -i $secondid }; catch { wait -i $secondid }
if {$failed} {
fail "$test"
} else {
-re {^WARNING: Number of errors: [0-9]*[^\r\n]*\r\n} { incr ok; exp_continue }
eof { }
}
+catch { close } ; catch { wait }
if {$ok >= 2 && $ko == 0} then { pass $test } else { fail "$test ($ok $ko)" }
-catch { wait } ; catch { close }
set test "pr13306 -t"
spawn stap -t $srcdir/$subdir/pr13306.stp
-re {^[^\r\n]*hits:[^\r\n]*cycles:[^\r\n]*from:[^\r\n]*\r\n} { exp_continue }
-re {^----- refresh report:\r\n} { exp_continue }
}
+catch { close } ; catch { wait }
if {$ok >=3 && $ko == 0} then { pass $test } else { fail "$test ($ok $ko)" }
-catch { wait } ; catch { close }
set test "pr13306 --suppress-handler-errors"
spawn stap --suppress-handler-errors $srcdir/$subdir/pr13306.stp
-re {^WARNING: Number of errors: [0-9]*[^\r\n]*\r\n} { incr ok; exp_continue }
eof { }
}
+catch { close } ; catch { wait }
if {$ok == 1 && $ko == 0} then { pass $test } else { fail "$test ($ok $ko)" }
-catch { wait } ; catch { close }
set test "pr13306 --suppress-handler-errors -t"
spawn stap --suppress-handler-errors -t $srcdir/$subdir/pr13306.stp
-re {^[^\r\n]*hits:[^\r\n]*cycles:[^\r\n]*from:[^\r\n]*\r\n} { exp_continue }
-re {^----- refresh report:\r\n} { exp_continue }
}
+catch { close } ; catch { wait }
if {$ok >= 2 && $ko == 0} then { pass $test } else { fail "$test ($ok $ko)" }
-catch { wait } ; catch { close }
-re {^ERROR: [^\r\n]*\r\n} { incr ko; exp_continue }
eof { }
}
+catch { close }; catch { wait }
if {$ko == 0} then { pass $test } else { fail "$test ($ko)" }
-catch { wait } ; catch { close }
set test "pr14546 twice"
spawn stap $srcdir/$subdir/pr14546.stp "println(backtrace()); println(backtrace())"
-re {^ERROR: [^\r\n]*\r\n} { incr ko; exp_continue }
eof { }
}
+catch { close }; catch { wait }
if {$ko == 0} then { pass $test } else { fail "$test ($ko)" }
-catch { wait } ; catch { close }
set test "pr14546 thrice"
spawn stap $srcdir/$subdir/pr14546.stp "println(backtrace()); println(backtrace()); println(backtrace())"
-re {^ERROR: [^\r\n]*\r\n} { incr ko; exp_continue }
eof { }
}
+catch { close }; catch { wait }
if {$ko == 0} then { pass $test } else { fail "$test ($ko)" }
-catch { wait } ; catch { close }
set test "pr14546 followed by ubacktrace()"
spawn stap $srcdir/$subdir/pr14546.stp "println(backtrace()); println(ubacktrace())"
-re {^ERROR: [^\r\n]*\r\n} { incr ko; exp_continue }
eof { }
}
+catch { close }; catch { wait }
if {$ko == 0} then { pass $test } else { fail "$test ($ko)" }
-catch { wait } ; catch { close }
timeout { fail "$test (timeout)" }
eof
}
- wait
+ catch { close }; catch { wait }
if {$ok > 10} { pass $test } else { fail $test }
}
timeout { fail "$test (timeout)" }
eof
}
- wait
+ catch { close }; catch { wait }
if {$ok > 10} { pass $test } else { fail $test }
}
timeout { fail "$test timeout" }
eof { }
}
-set res [wait -i $spawn_id]
catch { close }
+set res [wait -i $spawn_id]
set res [lindex $res 3]
if { $res != 0 || $compile_errors > 0 } {
fail $test
timeout { fail "$exe (timeout)" }
eof { }
}
- wait
+ catch { close }; catch { wait }
if {$ok == 3 && $warn == 0} {
pass "$exe"
-timeout 20
-re "terminated" {incr success}
}
+catch { close }; catch { wait }
if {$success == 1} {pass $test} {fail $test}
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
# WARNINGs get collapsed, so only 1 expected ... plus the two from staprun re. the ERROR exits.
if {$systems == 8 && $warns == 3 && $errors == 8 && $prints == 1} { pass "$test" } { fail "$test ($systems,$warns,$errors,$prints)" }
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
+
# There can be more than 3 "too many pending" messages in case
# stap recovered quick enough and then overflowed again.
if {$ok == 3 && $warn >= 3} {
timeout { fail "$test (timeout)" }
eof { }
}
-wait
+catch { close }; catch { wait }
if {$ok == 14} {
pass $test
} else {
timeout { fail "$test (timeout)" }
eof { }
}
-#FIXME does not handle case of hanging symbols.stp correctly
-wait
+catch { kill -INT -[exp_pid] 2 }; catch { close }; catch { wait }
if {$ok == 11} { pass "$test ($ok)" } { fail "$test ($ok)" }
fail "$testname unexpected EOF" }
-re "semantic error:" { pass "$testname correctly failed to compile" }
}
- close
- wait
+ catch { close }; catch { wait }
}
set donepos [lsearch $idlist $expect_out(spawn_id)]
set idlist [lreplace $idlist $donepos $donepos]
incr runningcount -1
+ catch { close -i $expect_out(spawn_id) }
wait -i $expect_out(spawn_id)
} timeout {
break