| 1 |
set test main_quiesce |
| 2 |
if {! [installtest_p]} { |
| 3 |
untested $test |
| 4 |
return |
| 5 |
} |
| 6 |
|
| 7 |
# This test makes sure we don't miss events when the main thread |
| 8 |
# doesn't quiesce (without us interrupting it). |
| 9 |
|
| 10 |
# Compile our threaded test program. |
| 11 |
set srcpath "$srcdir/$subdir/${test}.c" |
| 12 |
set exepath "./${test}_exe" |
| 13 |
set res [target_compile $srcpath $exepath executable "additional_flags=-g libs=-lpthread"] |
| 14 |
if { $res != "" } { |
| 15 |
verbose "target_compile failed: $res" 2 |
| 16 |
fail "$test - unable to compile [file tail $srcpath]" |
| 17 |
return |
| 18 |
} else { |
| 19 |
pass "$test - compiled [file tail $srcpath]" |
| 20 |
} |
| 21 |
|
| 22 |
set test_script { |
| 23 |
global hits |
| 24 |
probe begin { |
| 25 |
printf("systemtap starting probe\n") |
| 26 |
} |
| 27 |
|
| 28 |
probe process("%s").function("spool_write_script") { |
| 29 |
hits <<< 1 |
| 30 |
} |
| 31 |
|
| 32 |
probe end { |
| 33 |
printf("systemtap ending probe\n") |
| 34 |
printf("hits = %%d\n", @sum(hits)) |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
set output "hits = \[1-9\]\[0-9\]*\r\n" |
| 39 |
set script [format $test_script $exepath] |
| 40 |
verbose -log $script |
| 41 |
|
| 42 |
foreach runtime [get_runtime_list] { |
| 43 |
set test_name "$test" |
| 44 |
|
| 45 |
# Run the test executable. |
| 46 |
spawn $exepath |
| 47 |
set exe_id $spawn_id |
| 48 |
|
| 49 |
if {$runtime != ""} { |
| 50 |
lappend test_name "($runtime)" |
| 51 |
|
| 52 |
stap_run $test_name wait_5_secs $output --runtime=$runtime \ |
| 53 |
-e $script -x [exp_pid -i $exe_id] |
| 54 |
|
| 55 |
} elseif {[uprobes_p]} { |
| 56 |
stap_run $test_name wait_5_secs $output -e $script \ |
| 57 |
-x [exp_pid -i $exe_id] |
| 58 |
} else { |
| 59 |
untested "$test (uprobes)" |
| 60 |
} |
| 61 |
|
| 62 |
kill -INT -[exp_pid -i $exe_id] 2 |
| 63 |
catch {close -i $exe_id} |
| 64 |
catch {wait -i $exe_id} |
| 65 |
} |
| 66 |
exec rm -f $test |