summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/utrace_p5.exp
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2008-06-11 10:37:32 -0500
committerDavid Smith <dsmith@redhat.com>2008-06-11 11:19:26 -0500
commit1461de23ee84384940626145f07b0a736a2d8bb3 (patch)
tree33f7f61be6c6a1d908164784812b575ed55f84a5 /testsuite/systemtap.base/utrace_p5.exp
parentf2782fe588397a5baa313eb825dd4c508818dc7e (diff)
downloadsystemtap-steved-1461de23ee84384940626145f07b0a736a2d8bb3.tar.gz
systemtap-steved-1461de23ee84384940626145f07b0a736a2d8bb3.tar.xz
systemtap-steved-1461de23ee84384940626145f07b0a736a2d8bb3.zip
Added .thread.begin and .thread.end utrace probe tests.
2008-06-11 David Smith <dsmith@redhat.com> * systemtap.base/utrace_p5.exp: Added 'process().thread.begin' and 'process().thread.end' tests. * systemtap.base/utrace_p5_multi.c: Added multi-threaded test program for utrace_p5.exp. * .gitignore: Updated.
Diffstat (limited to 'testsuite/systemtap.base/utrace_p5.exp')
-rw-r--r--testsuite/systemtap.base/utrace_p5.exp70
1 files changed, 68 insertions, 2 deletions
diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp
index 46e3181b..1185f015 100644
--- a/testsuite/systemtap.base/utrace_p5.exp
+++ b/testsuite/systemtap.base/utrace_p5.exp
@@ -3,6 +3,9 @@
# Initialize variables
set utrace_support_found 0
set exepath "[pwd]/cat_[pid]"
+set multi_srcpath "systemtap.base/utrace_p5_multi.c"
+set multi_exepath "[pwd]/utrace_p5_multi_[pid]"
+set multi_flags "libs=-lpthread"
set end_script {
global end_probes_fired = 0
@@ -46,6 +49,30 @@ set syscall_return_script {
}
set syscall_return_script_output "syscall_returns = \\d+\r\n"
+set thread_begin_script {
+ global thread_begin_probes_fired = 0
+ probe begin { printf("systemtap starting probe\n") }
+ probe process("%s").thread.begin { thread_begin_probes_fired++ }
+ probe end { printf("systemtap ending probe\n")
+ if (thread_begin_probes_fired > 0) {
+ printf("thread_begins = %%d\n", thread_begin_probes_fired)
+ }
+ }
+}
+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"
if {! [catch {exec grep -q utrace_attach $path} dummy]} {
@@ -74,6 +101,25 @@ 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"
@@ -114,7 +160,27 @@ if {$utrace_support_found == 0} {
stap_run $TEST_NAME run_cat_5_sec $syscall_return_script_output -e $script
}
-# We need thread.begin and thread.end tests!
+set TEST_NAME "UTRACE_P5_05"
+if {$utrace_support_found == 0} {
+ untested "$TEST_NAME : no kernel utrace support found"
+} elseif {![installtest_p]} {
+ untested "$TEST_NAME"
+} else {
+ 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