diff options
Diffstat (limited to 'testsuite/systemtap.base/utrace_p5.exp')
-rw-r--r-- | testsuite/systemtap.base/utrace_p5.exp | 92 |
1 files changed, 69 insertions, 23 deletions
diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index cbb867d1..fcd617fe 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -3,24 +3,27 @@ # Initialize variables set utrace_support_found 0 set exepath "[pwd]/cat_[pid]" +set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c" +set multi_exepath "[pwd]/utrace_p5_multi_[pid]" +set multi_flags "libs=-lpthread" -set death_script { - global death_probes_fired = 0 +set end_script { + global end_probes_fired = 0 probe begin { printf("systemtap starting probe\n") } - probe process("%s").death { death_probes_fired++ } + probe process("%s").end { end_probes_fired++ } probe end { printf("systemtap ending probe\n") - printf("deaths = %%d\n", death_probes_fired) } + printf("end probes = %%d\n", end_probes_fired) } } -set death_script_output "deaths = 1\r\n" +set end_script_output "end probes = 1\r\n" -set exec_script { - global exec_probes_fired = 0 +set begin_script { + global begin_probes_fired = 0 probe begin { printf("systemtap starting probe\n") } - probe process("%s").exec { exec_probes_fired++ } + probe process("%s").begin { begin_probes_fired++ } probe end { printf("systemtap ending probe\n") - printf("execs = %%d\n", exec_probes_fired) } + printf("begin probes = %%d\n", begin_probes_fired) } } -set exec_script_output "execs = 1\r\n" +set begin_script_output "begin probes = 1\r\n" set syscall_script { global syscall_probes_fired = 0 @@ -46,17 +49,29 @@ set syscall_return_script { } set syscall_return_script_output "syscall_returns = \\d+\r\n" -set clone_script { - global clone_probes_fired = 0 +set thread_begin_script { + global thread_begin_probes_fired = 0 probe begin { printf("systemtap starting probe\n") } - probe process(%d).clone { clone_probes_fired++ } + probe process("%s").thread.begin { thread_begin_probes_fired++ } probe end { printf("systemtap ending probe\n") - if (clone_probes_fired > 0) { - printf("clones = %%d\n", clone_probes_fired) + if (thread_begin_probes_fired > 0) { + printf("thread_begins = %%d\n", thread_begin_probes_fired) } } } -set clone_script_output "clones = \\d+\r\n" +set thread_begin_script_output "thread_begins = \\d+\r\n" + +set thread_end_script { + global thread_end_probes_fired = 0 + probe begin { printf("systemtap starting probe\n") } + probe process("%s").thread.end { thread_end_probes_fired++ } + probe end { printf("systemtap ending probe\n") + if (thread_end_probes_fired > 0) { + printf("thread_ends = %%d\n", thread_end_probes_fired) + } + } +} +set thread_end_script_output "thread_ends = \\d+\r\n" # Try to find utrace_attach symbol in /proc/kallsyms set path "/proc/kallsyms" @@ -86,14 +101,33 @@ proc run_cat_5_sec {} { return 0; } +# Compile our multi-threaded test program. +set res [target_compile $multi_srcpath $multi_exepath executable $multi_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "unable to compile $multi_srcpath" + return +} + +# "load" generation function for stap_run. It spawns our +# multi-threaded test program and waits for it to finish. +proc run_utrace_p5_multi {} { + global multi_exepath + + if {[catch {exec $multi_exepath} res]} { + verbose "unable to run $multi_exepath: $res" + } + return 0; +} + set TEST_NAME "UTRACE_P5_01" if {$utrace_support_found == 0} { untested "$TEST_NAME : no kernel utrace support found" } elseif {![installtest_p]} { untested "$TEST_NAME" } else { - set script [format $death_script $exepath] - stap_run $TEST_NAME run_cat_5_sec $death_script_output -e $script + set script [format $end_script $exepath] + stap_run $TEST_NAME run_cat_5_sec $end_script_output -e $script } set TEST_NAME "UTRACE_P5_02" @@ -102,8 +136,8 @@ if {$utrace_support_found == 0} { } elseif {![installtest_p]} { untested "$TEST_NAME" } else { - set script [format $exec_script $exepath] - stap_run $TEST_NAME run_cat_5_sec $exec_script_output -e $script + set script [format $begin_script $exepath] + stap_run $TEST_NAME run_cat_5_sec $begin_script_output -e $script } set TEST_NAME "UTRACE_P5_03" @@ -132,9 +166,21 @@ if {$utrace_support_found == 0} { } elseif {![installtest_p]} { untested "$TEST_NAME" } else { - set script [format $clone_script [pid]] - stap_run $TEST_NAME run_cat_5_sec $clone_script_output -e $script + set script [format $thread_begin_script $multi_exepath] + stap_run $TEST_NAME run_utrace_p5_multi $thread_begin_script_output \ + -e $script +} + +set TEST_NAME "UTRACE_P5_06" +if {$utrace_support_found == 0} { + untested "$TEST_NAME : no kernel utrace support found" +} elseif {![installtest_p]} { + untested "$TEST_NAME" +} else { + set script [format $thread_end_script $multi_exepath] + stap_run $TEST_NAME run_utrace_p5_multi $thread_end_script_output \ + -e $script } # Cleanup -exec rm -f $exepath +exec rm -f $exepath $multi_exepath |