]> sourceware.org Git - systemtap.git/commitdiff
Handle testsuite 'spawn' calls correctly by calling 'close' and 'wait'.
authorDavid Smith <dsmith@redhat.com>
Thu, 8 Sep 2016 16:09:59 +0000 (11:09 -0500)
committerDavid Smith <dsmith@redhat.com>
Thu, 8 Sep 2016 16:09:59 +0000 (11:09 -0500)
* testsuite/systemtap.base/auto_path.exp: Add 'close' and 'wait' calls
  after a 'spawn'.
* testsuite/systemtap.base/const_op.exp: Ditto.
* testsuite/systemtap.base/kallsyms.exp: Ditto.
* testsuite/systemtap.base/timeout.exp: Ditto.
* testsuite/systemtap.context/symbols.exp: Kill spawned stap process and
  call 'close' before calling 'wait'.
* testsuite/systemtap.base/flightrec1.exp: Fix location of close/wait
  calls.
* testsuite/systemtap.base/flightrec2.exp: Ditto.
* testsuite/systemtap.base/flightrec3.exp: Ditto.
* testsuite/systemtap.base/flightrec4.exp: Ditto.
* testsuite/systemtap.base/flightrec5.exp: Ditto.
* testsuite/systemtap.base/crash.exp: Call 'catch' around individual
  'close' and 'wait' calls.
* testsuite/systemtap.maps/foreach_fail.exp: Ditto.
* testsuite/systemtap.base/backtrace.exp: Call 'catch' around 'wait'
  calls.
* testsuite/systemtap.base/cache_clean.exp: Ditto.
* testsuite/lib/systemtap.exp (setup_server): Add 'catch' around 'exec'.
  (stap_run_batch): Call 'close' before calling 'wait'.
* testsuite/lib/stap_compile.exp (stap_compile): Call 'close' before
  calling 'wait'.
* testsuite/systemtap.base/alternatives.exp: Ditto.
* testsuite/systemtap.base/at_var_unresolved.exp: Ditto.
* testsuite/systemtap.base/at_var_unresolved_lvalue.exp: Ditto.
* testsuite/systemtap.base/at_var_void_stmt.exp: Ditto.
* testsuite/systemtap.base/bz10078.exp: Ditto.
* testsuite/systemtap.base/bz1074541.exp: Ditto.
* testsuite/systemtap.base/bz1126645.exp: Ditto.
* testsuite/systemtap.base/bz13338.exp: Ditto.
* testsuite/systemtap.base/cmd_parse.exp: Ditto.
* testsuite/systemtap.base/debugpath.exp: Ditto.
* testsuite/systemtap.base/deref2.exp: Ditto.
* testsuite/systemtap.base/func_alias.exp: Ditto.
* testsuite/systemtap.base/multisym.exp: Ditto.
* testsuite/systemtap.base/pr13158.exp: Ditto.
* testsuite/systemtap.base/pr13306.exp: Ditto.
* testsuite/systemtap.base/pr14546.exp: Ditto.
* testsuite/systemtap.base/prologues.exp: Ditto.
* testsuite/systemtap.base/pthread_stacks.exp: Ditto.
* testsuite/systemtap.base/rep_ret.exp: Ditto.
* testsuite/systemtap.base/wakeup.exp: Ditto.
* testsuite/systemtap.base/warn_overflow.exp: Ditto.
* testsuite/systemtap.base/warnings.exp: Ditto.
* testsuite/systemtap.stress/whitelist.exp: Ditto.
* testsuite/systemtap.apps/tcl.exp: Update 'spawn' comment.

40 files changed:
testsuite/lib/stap_compile.exp
testsuite/lib/systemtap.exp
testsuite/systemtap.apps/tcl.exp
testsuite/systemtap.base/alternatives.exp
testsuite/systemtap.base/at_var_unresolved.exp
testsuite/systemtap.base/at_var_unresolved_lvalue.exp
testsuite/systemtap.base/at_var_void_stmt.exp
testsuite/systemtap.base/auto_path.exp
testsuite/systemtap.base/backtrace.exp
testsuite/systemtap.base/bz10078.exp
testsuite/systemtap.base/bz1074541.exp
testsuite/systemtap.base/bz1126645.exp
testsuite/systemtap.base/bz13338.exp
testsuite/systemtap.base/cache_clean.exp
testsuite/systemtap.base/cmd_parse.exp
testsuite/systemtap.base/const_op.exp
testsuite/systemtap.base/crash.exp
testsuite/systemtap.base/debugpath.exp
testsuite/systemtap.base/deref2.exp
testsuite/systemtap.base/flightrec1.exp
testsuite/systemtap.base/flightrec2.exp
testsuite/systemtap.base/flightrec3.exp
testsuite/systemtap.base/flightrec4.exp
testsuite/systemtap.base/flightrec5.exp
testsuite/systemtap.base/func_alias.exp
testsuite/systemtap.base/kallsyms.exp
testsuite/systemtap.base/multisym.exp
testsuite/systemtap.base/pr13158.exp
testsuite/systemtap.base/pr13306.exp
testsuite/systemtap.base/pr14546.exp
testsuite/systemtap.base/prologues.exp
testsuite/systemtap.base/pthread_stacks.exp
testsuite/systemtap.base/rep_ret.exp
testsuite/systemtap.base/timeout.exp
testsuite/systemtap.base/wakeup.exp
testsuite/systemtap.base/warn_overflow.exp
testsuite/systemtap.base/warnings.exp
testsuite/systemtap.context/symbols.exp
testsuite/systemtap.maps/foreach_fail.exp
testsuite/systemtap.stress/whitelist.exp

index 8780930ee9b9b1a30e5976d5f1d3f21460bf8768..c8d44203d275ee2e4ed38a7f4814713409cefc28 100644 (file)
@@ -19,8 +19,8 @@ proc stap_compile { TEST_NAME compile script args } {
        -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)
index 879dd248bc4775ddb041b963fac3349b23bf6dd3..99c150fcfcd839b9dd3bd87f56fba7f95fc55599 100644 (file)
@@ -354,7 +354,7 @@ proc setup_server { args } {
     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]
@@ -666,6 +666,7 @@ proc stap_run_batch {filename args} {
         -re {[^\r\n]*\r\n} { exp_continue }
         eof { }
     }
+    catch { close }
     set results [wait]
     verbose -log "wait results: $results"
     if {[llength $results] >= 5} {
index bd9684faeb0e35c15300ba7e4ac4ff1287d7d2cd..ff3ea6956f26d752de77f16d0607206096cd59df 100644 (file)
@@ -29,7 +29,7 @@ if {$rc != 0} {
 }
 
 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} {
index 8e8b163fc10094a7233cecae1e30b1bdfccc5e97..63352306070b12199d27e68ec714b2d9fdc85eee 100644 (file)
@@ -32,6 +32,7 @@ proc stap_run_alternatives {args} {
         eof { verbose -log "EOF" }
         timeout { verbose -log "TIMEOUT" }
     }
+    catch { close }
     set results [wait]
     verbose -log "wait results: $results"
     return $alternatives_found
index 824722446738ac29ad6ed107a65a402f98f0e4c5..3f1022385f2dd6f3dd821c33bd5e0775503afc79 100644 (file)
@@ -26,7 +26,7 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 
 if {$errs == 1} {
     pass "$test ($errs)"
@@ -58,7 +58,7 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 
 if {$ok == 1 && $errs == 0} {
     pass "$test (cuname: $ok, $errs)"
index 13067977a26959fd366ff5904951350c06768edf..7945eeba918ca19f0335d276463b67076b160934 100644 (file)
@@ -30,7 +30,7 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 
 if {$ok == 1} {
     pass "$test"
index 8e7c215b1326ed8bf6f522a6fb84cf6e20ec90f0..dee38b4d269cd68033fbbe2e17722b72c5de80a1 100644 (file)
@@ -37,7 +37,7 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 
 if {$ok == 1 && $logs == 2} {
     pass "$test ($ok, $logs)"
index 72624ee4479dc80719b5a3f9382ab8058eab7bbc..f81519dcb670b7323a603983591786207fb88ea6 100644 (file)
@@ -31,6 +31,7 @@ expect {
       }
   }
 }
+catch { close }; catch { wait }
 if {$status == 1} {pass ${test}1} else {fail ${test}1}
 
 set status 0
@@ -45,6 +46,7 @@ expect {
     }
   }
 }
+catch { close }; catch { wait }
 if {$status == 1} {pass ${test}2} else {fail ${test}2}
 
 set status 0
@@ -59,6 +61,7 @@ expect {
     }
   }
 }
+catch { close }; catch { wait }
 if {$status == 1} {pass ${test}3} else {fail ${test}3}
 
 # cleanup
index 2a4f99b5ef41b38526c781b26c7f04af98b6b2d1..d2983f9e2ddc949e5e89feefe96f416c77833e2c 100644 (file)
@@ -20,7 +20,7 @@ expect {
     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)" }
 
 
@@ -43,7 +43,7 @@ expect {
     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"
@@ -63,6 +63,6 @@ expect {
     eof { }
     timeout { fail "$test (timeout)" }
 }
-catch { close }; wait
+catch { close }; catch { wait }
 if {$ok == 0} then { pass "$test ($ok)" } else { fail "$test ($ok)" }
 
index fbd848dd643221cdece5849712ac60c90fcdf7e0..3d0f8faf3de90a588181b234d9b55feb4859ab44 100644 (file)
@@ -28,6 +28,6 @@ expect {
        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
index f7ef8267f49a893c535a32be37b1f2f16a0c328a..a335a6af0bb194eec8ac509bb677939c3474f4b0 100644 (file)
@@ -3,7 +3,7 @@ set test "./bz1074541"
 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.
index 0fceb25dc587c4455d9b0a49c758edefdd1756dd..e30a3d4626589ce9617356169d10bb87ac29b0eb 100644 (file)
@@ -14,6 +14,6 @@ expect {
        timeout { fail "$test (timeout)" }
        eof { }
 }
-wait
+catch { close }; catch { wait }
 if {$ok == 1} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" }
 
index fa1774f3abb96d3b7d0ffd58b026a31531c0ad6c..3af93f7167e14af986e7f9675c585fb58f4ebbbf 100644 (file)
@@ -14,5 +14,5 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 if {$ok > 0 && $ko == 0} then { pass "$test" } else { fail "$test $ok $ko" }
index ce89b32c9b9b02a39a8d4eba0a9f446c83179bf9..f660ffd2e7f609bd9d7a7aa637e5f8e9c42b1616 100644 (file)
@@ -33,8 +33,7 @@ expect {
 
   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
@@ -52,8 +51,7 @@ expect {
 
   timeout { fail "$test (timeout)" }
 }
-catch close
-wait
+catch { close }; catch { wait }
 
 # Cleanup.
 exec /bin/rm -rf $local_systemtap_dir
index ec1b518ae73223ae7b6323c9785f6d99bf3a7519..58de01bf1a08ca43575cbfcd4a84f519f986dc48 100644 (file)
@@ -12,7 +12,7 @@ expect {
     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 {
@@ -21,7 +21,7 @@ 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 {
@@ -30,7 +30,7 @@ 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 {
@@ -39,7 +39,7 @@ 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 {
@@ -48,7 +48,7 @@ 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 {
@@ -57,7 +57,7 @@ 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 {
@@ -66,7 +66,7 @@ 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.*}
@@ -77,7 +77,7 @@ expect {
     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 {
@@ -86,7 +86,7 @@ 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 {
@@ -95,7 +95,7 @@ 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 {
@@ -104,7 +104,7 @@ 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 {
@@ -113,7 +113,7 @@ expect {
     timeout { fail "cmd_parse12 timeout" }
     eof { fail "cmd_parse12 eof" }
 }
-wait;catch {close}
+catch { close }; catch { wait }
 
 spawn stap -L syscall.a*
 expect {
@@ -122,7 +122,7 @@ 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"
@@ -147,7 +147,7 @@ expect {
     timeout { fail "cmd_parse15: timeout" }
     eof { fail "cmd_parse15: eof" }
 }
-wait;catch {close}
+catch { close }; catch { wait }
 
 set uname [exec uname -i]
 # normalize arch
@@ -162,7 +162,7 @@ expect {
     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.
index 4e8c0b101498063de1fd16390d4d04cbfeeb0225..aed4b45ac8c5f7a26e87f553ef1661dc711a490e 100644 (file)
@@ -18,6 +18,7 @@ expect {
     -re {^[^\n\r]+\r\n}
         {exp_continue}
 }
+catch { close }; catch { wait }
 if {$tst == 1} {
     pass "$test (non-guru)"
 } else {
index a22032fad656e34eda325bcb2bd3e44c3485f762..c7e6b8fbed1c2ea671dc2392c3e133328e85b484 100644 (file)
@@ -19,7 +19,7 @@ expect {
     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 }
index 059b6b0737f9f747df37448ec896ae50a9f98404..76e4c40b06c829f07103043d4525fe24cc84a82c 100644 (file)
@@ -6,8 +6,7 @@ expect {
        timeout { fail "$test (timeout1)" }
        eof { fail "$test (eof)" }
 }
-
-wait
+catch { close }; catch { wait }
 
 set test "debugpath-good"
 set uname [exec /bin/uname -r]
@@ -27,5 +26,4 @@ expect {
        timeout { fail "$test (timeout2)" }
        eof { fail "$test (eof)" }
 }
-
-wait
+catch { close }; catch { wait }
index 6ee85d1057daa95972ad99ac6f04f7c6ec0525be..7a4d67dbe9d326d5c5ddf8170f23ba6331c917c5 100644 (file)
@@ -24,6 +24,6 @@ expect {
     eof { }
     timeout { }
 }
-wait
+catch { close }; catch { wait }
 
 if {$neg > 0} { pass "$test ($pos $neg)" } else { fail "$test ($pos $neg)" }
index 7acbae789bf49dfcd47342449980fc736f5e44b8..d1a280ea0bf78d5d91e653c8aba89ed3ab4fc4e7 100644 (file)
@@ -6,6 +6,7 @@ catch {exec rm -f $test.out*}
 
 # 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 {
@@ -17,7 +18,7 @@ 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
@@ -31,7 +32,7 @@ expect {
   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
@@ -47,6 +48,7 @@ if {[catch {exec rm $test.out}]} {
 }
 
 kill -TERM $pid
+catch { close -i $stap_id }; catch { wait -i $stap_id }
 
 # check switched output file
 if {[catch {exec rm $test.out.1}]} {
index 74da9353d826155a9ae81a1634a9537e477a1641..4d8dc616e9d57ae3dd13785df3370883d710fc83 100644 (file)
@@ -7,6 +7,7 @@ system "rm -f flightlog.out*"
 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} {
@@ -16,7 +17,7 @@ expect {
   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
@@ -25,6 +26,7 @@ if {$pid == 0} {
 exec sleep 4
 set scnt 0
 set cnt1 0
+
 # wait for log files
 eval spawn stat -c %s [glob flightlog.out.*]
 expect {
@@ -35,9 +37,10 @@ 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 {
@@ -48,21 +51,25 @@ 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*"
 
index 8550fcaea40ebbd2c812a887e532173dd1bcf0fc..cba2e5568802d99347902778559fd1fdf3a7c7ee 100644 (file)
@@ -7,6 +7,7 @@ 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} {
@@ -16,7 +17,7 @@ expect {
   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
@@ -40,10 +41,11 @@ expect {
       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
@@ -56,7 +58,7 @@ expect {
       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
@@ -76,6 +78,7 @@ if {$scnt == $cnt} {
 }
 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*"}
 
index 6f2066d5e6b2bdea3b8069c04e2d3f34b835e0ff..aaf67f41826cb223f88c2ffbde277ed2735e79a8 100644 (file)
@@ -17,7 +17,8 @@ expect {
   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
@@ -52,6 +53,7 @@ if {[catch {exec rm $test.out.1}]} {
 }
 
 kill -TERM $pid 5
+catch { close }; catch { wait }
 
 # check switched output file
 if {[catch {exec rm $test.out.2 $test.out.3}]} {
index 768abab7da588a0fe161f402cfc66b5a2a6e8852..d9605a84fc195e98f19365f90bffd303f6bb3c10 100644 (file)
@@ -17,7 +17,7 @@ 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
@@ -47,6 +47,7 @@ kill -USR2 $pid
 
 exec sleep 2
 kill -TERM $pid 5
+catch { close }; catch { wait }
 
 # check switched output file
 exec sleep 2
index b49d73cb7ccf65147b3b6b450e4ca9a4ae019025..621bab2608b5c2bb59b6271ac7f6c880da6a9f60 100644 (file)
@@ -17,7 +17,7 @@ proc run {subtest pp} {
     }
     eof { if {$match == 0} { fail $subtest } }
   }
-  wait
+  catch { close }; catch { wait }
 }
 
 proc run_one_test {flags bits} {
index 7b4c33fffecf932ed4ce421d5a89461c7e19b931..8ee52422dc62f7ab11cb9831e5639f792f542a5d 100644 (file)
@@ -14,6 +14,7 @@ expect {
     set passed 1
   }
 }
+catch { close }; catch { wait }
 
 if {$passed == 1} {
   pass $test
index b8c96cef856387d9ce679d141888fc973c30e463..177c11f0b846e9c8b1ab664812eab97b6b1bb808 100755 (executable)
@@ -35,8 +35,8 @@ set results 0
 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} {
index 48b73ab07a40b799d94085548ac43289ba3b2c4a..d98c93c9bb04981c5d7a3343e31ae0e9daf4d745 100644 (file)
@@ -59,7 +59,8 @@ set firstpid [exp_pid -i $firstid]
 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 {
index d31790e1391ae7fe36302713ddacedb3f3d39506..4976695bd106d4d29db62936a47b40edf3c1894a 100644 (file)
@@ -15,8 +15,8 @@ expect {
     -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
@@ -31,8 +31,8 @@ expect {
     -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
@@ -45,8 +45,8 @@ expect {
     -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
@@ -61,5 +61,5 @@ expect {
     -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 }
index 6b4310376c4b6ae6ee4ce35b92530ffec57044b1..bb1fe883db685a55a21fc7dbeb365a8a6c69c9d4 100644 (file)
@@ -13,8 +13,8 @@ expect {
     -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())"
@@ -25,8 +25,8 @@ expect {
     -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())"
@@ -37,8 +37,8 @@ expect {
     -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())"
@@ -49,5 +49,5 @@ expect {
     -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 }
index 48f994a5cf8d7929496f44a2508fe97b3846d30e..22fdb71b6647383dbdd4f247f6d99a0cb1098889 100644 (file)
@@ -9,7 +9,7 @@ if {! [installtest_p]} { untested $test } else {
         timeout { fail "$test (timeout)" }
         eof
     }
-    wait
+    catch { close }; catch { wait }
     if {$ok > 10} { pass $test } else { fail $test }
 }
 
@@ -24,7 +24,7 @@ if {! [installtest_p]} { untested $test } else {
         timeout { fail "$test (timeout)" }
         eof
     }
-    wait
+    catch { close }; catch { wait }
     if {$ok > 10} { pass $test } else { fail $test }
 }
 
index a270aedc3230998adde879b8ddb114979b6539b2..dec7e057d7adf8a07819aa5e19758f6c4608203d 100644 (file)
@@ -40,8 +40,8 @@ expect {
     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
index 75b64dfa45fb54f65ec317f86306e59f894238f3..196c459c789911e098c4c8fcb705256acac9eb5f 100644 (file)
@@ -47,7 +47,7 @@ foreach arch $arches {
       timeout { fail "$exe (timeout)" }
       eof { }
     }
-    wait
+    catch { close }; catch { wait }
 
     if {$ok == 3 && $warn == 0} {
       pass "$exe"
index e446f9ebd2592549e226b7594db8bdbd91c3cab6..1e28354d31843649a0d02f77f2df6059d0bb29ee 100644 (file)
@@ -8,4 +8,5 @@ expect {
   -timeout 20
   -re "terminated" {incr success}
 }
+catch { close }; catch { wait }
 if {$success == 1} {pass $test} {fail $test}
index 13bc06eca3e9611fce48d7182b806b68814b9f2f..a7a649d749743820229f33f3dcfa6ca496b138e4 100644 (file)
@@ -18,7 +18,7 @@ expect {
     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)" }
index 76f1bd130d73408da41b7e2c7319501247500a33..3df4c33421ee1b99762c8c9684dce25b00bd0285 100644 (file)
@@ -25,7 +25,8 @@ expect {
     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} {
index 2ad5fc188f217f11c50d8f4ffc56b7f5c118a119..9a967674e9994bf56e32b39e43e2c965451f354c 100644 (file)
@@ -11,7 +11,7 @@ expect {
     timeout { fail "$test (timeout)" }
     eof { }
 }
-wait
+catch { close }; catch { wait }
 if {$ok == 14} {
     pass $test
 } else {
index 0c599b586310ee1e43db1fa4043743c99af137e6..23ddc0515ca5ad45738312bf9dd292b0e182f87a 100644 (file)
@@ -9,6 +9,5 @@ expect {
     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)" }
index f1d3593bd8fe46cdcf1ccb53caf169208356a4fd..f54a1a4605ad7a1836be9dffd4408ece8a44aa1d 100644 (file)
@@ -21,6 +21,5 @@ foreach runtime [get_runtime_list] {
            fail "$testname unexpected EOF" }
        -re "semantic error:" { pass "$testname correctly failed to compile" }
     }
-    close
-    wait
+    catch { close }; catch { wait }
 }
index 7bc1894e301cff7dee10454c18c6458fdb986db2..2c4d35be502ecc0cc020952f7afb69e0bc77ee77 100644 (file)
@@ -354,6 +354,7 @@ proc runbenchs {} {
                        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
This page took 0.075821 seconds and 5 git commands to generate.