| 1 |
# This test is to make sure that we've resolved PR10854's race between probe |
| 2 |
# initialization and shutdown. Here we load a module and then kill the stapio |
| 3 |
# process as soon as we can to try to make the init and shutdown overlap. |
| 4 |
|
| 5 |
set test "pr10854" |
| 6 |
|
| 7 |
# precompile the script module (use -w to suppress warnings re. blocklisted |
| 8 |
# functions such as vfs_caches_init_early()) |
| 9 |
set compile { exec stap -w $srcdir/$subdir/$test.stp ksys_read vfs*@fs/*.c -p4 } |
| 10 |
if { [catch { set module [eval $compile] } msg ] } { |
| 11 |
fail "compiling $test.stp: $msg" |
| 12 |
untested "$test runloop" |
| 13 |
continue |
| 14 |
} else { |
| 15 |
pass "compiling $test.stp" |
| 16 |
} |
| 17 |
|
| 18 |
if {![installtest_p]} { |
| 19 |
untested "$test runloop" |
| 20 |
continue |
| 21 |
} |
| 22 |
|
| 23 |
# run & kill the module 10 times |
| 24 |
# (this was usually enough to trigger the fault) |
| 25 |
for {set i 0} {$i < 10} {incr i} { |
| 26 |
spawn staprun $module -o /dev/null |
| 27 |
sleep 1 |
| 28 |
catch { exec pkill stapio -P [pid] 2>/dev/null } |
| 29 |
catch { exec pkill -9 stapio -P [pid] 2>/dev/null } |
| 30 |
catch { close } |
| 31 |
catch { wait } |
| 32 |
# don't delay before the next staprun |
| 33 |
} |
| 34 |
|
| 35 |
# Killing stapio with SIGKILL can leave the module behind. |
| 36 |
catch { exec staprun -d $module } |
| 37 |
|
| 38 |
# if we're still alive, we pass :) |
| 39 |
pass "$test runloop" |