summaryrefslogtreecommitdiffstats
path: root/systemtap.base
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-08-06 12:06:06 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-08-06 12:06:06 -0400
commit3c4371661f144c331dd55ee6be8dab57ec2323c8 (patch)
tree217ccf5864840f14670138b592d90eceacc75fa3 /systemtap.base
parent44ab6f3be72e7b5eeaa2514cea0553b87007ee9c (diff)
parent0317fad416059781b7a152296c1d8b5a012bf925 (diff)
downloadsystemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.tar.gz
systemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.tar.xz
systemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.zip
Merge commit 'origin/master' into pr4225
* commit 'origin/master': Use relative instead of absolute line. (bug 6611) move post-0.7 news tidbit to the top Add test for $$vars, $$params, $$locals. typographical tweaks for embedded script code Add $$vars, $$parms, $$locals Rename $path to $pathname of syscall tapset for 2.6.27 Correct several tests for 2.6.27 c code generation: assert C indentation/nesting cancels out at appropriate points Tweak test_installcheck for helloworld.meta and traceio2.meta. Run both tests for installcheck tests. No need for random suffix file cmdline and sysinfo files in the Ensure that a systemtap server is available if 'server' is specified session.h (struct systemtap_session): Added itrace_derived_probe * syscalls2.stp: Add sys_unlinkat. Fix on_each_cpu() call for kernels >2.6.26. Remove unused STAPCONF_MODULE_NSECTIONS
Diffstat (limited to 'systemtap.base')
-rw-r--r--systemtap.base/itrace.exp102
1 files changed, 102 insertions, 0 deletions
diff --git a/systemtap.base/itrace.exp b/systemtap.base/itrace.exp
new file mode 100644
index 00000000..4b73ac1c
--- /dev/null
+++ b/systemtap.base/itrace.exp
@@ -0,0 +1,102 @@
+# itrace test
+
+# Initialize variables
+set utrace_support_found 0
+set exepath "[pwd]/ls_[pid]"
+
+set itrace1_script {
+ global instrs = 0
+ probe begin { printf("systemtap starting probe\n") }
+ probe process("%s").itrace
+ {
+ instrs += 1
+ if (instrs == 5)
+ exit()
+ }
+
+
+ probe end { printf("systemtap ending probe\n")
+ printf("itraced = %%d\n", instrs)
+ }
+}
+set itrace1_script_output "itraced = 5\r\n"
+
+set itrace2_script {
+ global instrs = 0, itrace_on = 0, start_timer = 0
+ probe begin { start_timer = 1; printf("systemtap starting probe\n") }
+ probe process("%s").itrace if (itrace_on)
+ {
+ instrs += 1
+ if (instrs == 5)
+ exit()
+ }
+
+
+ probe timer.ms(1) if (start_timer)
+ {
+ itrace_on = 1
+ }
+
+ probe timer.ms(10) if (start_timer)
+ {
+ itrace_on = 0
+ }
+ probe end { printf("systemtap ending probe\n")
+ printf("itraced = %%d\n", instrs)
+ }
+}
+set itrace2_script_output "itraced = 5\r\n"
+
+
+# Set up our own copy of /bin/ls, to make testing for a particular
+# executable easy. We can't use 'ln' here, since we might be creating
+# a cross-device link. We can't use 'ln -s' here, since the kernel
+# resolves the symbolic link and reports that /bin/ls is being
+# exec'ed (instead of our local copy).
+if {[catch {exec cp /bin/ls $exepath} res]} {
+ fail "unable to copy /bin/ls: $res"
+ return
+}
+
+# "load" generation function for stap_run. It spawns our own copy of
+# /bin/ls, waits 5 seconds, then kills it.
+proc run_ls_5_sec {} {
+ global exepath
+
+ spawn $exepath
+ set exe_id $spawn_id
+ after 5000;
+ exec kill -INT -[exp_pid -i $exe_id]
+ return 0;
+}
+
+
+# Try to find utrace_attach symbol in /proc/kallsyms
+set path "/proc/kallsyms"
+if {! [catch {exec grep -q utrace_attach $path} dummy]} {
+ set utrace_support_found 1
+}
+
+set TEST_NAME "itrace1"
+if {$utrace_support_found == 0} {
+ untested "$TEST_NAME : no kernel utrace support found"
+} elseif {![installtest_p]} {
+ untested "$TEST_NAME : not installtest_p"
+} else {
+ set script [format $itrace1_script $exepath]
+ stap_run $TEST_NAME run_ls_5_sec $itrace1_script_output -e $script
+}
+
+
+set TEST_NAME "itrace2"
+if {$utrace_support_found == 0} {
+ untested "$TEST_NAME : no kernel utrace support found"
+} elseif {![installtest_p]} {
+ untested "$TEST_NAME : not installtest_p"
+} else {
+ set script [format $itrace2_script $exepath]
+ stap_run $TEST_NAME run_ls_5_sec $itrace2_script_output -e $script
+}
+
+# Cleanup
+exec rm -f $exepath