diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 17:34:47 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 17:34:47 -0400 |
commit | 42e740602dbb7960e11b0bbf9053e95e8a1cb1e5 (patch) | |
tree | aa32f56c7c5b1838e9d80bec2c15325c71742660 /testsuite/systemtap.base/itrace.exp | |
parent | 3213d0891c826f16ba727a3e863075e2922666a0 (diff) | |
parent | 79640c29c5bcf8de20f013dcc80e1a9c7a93811f (diff) | |
download | systemtap-steved-42e740602dbb7960e11b0bbf9053e95e8a1cb1e5.tar.gz systemtap-steved-42e740602dbb7960e11b0bbf9053e95e8a1cb1e5.tar.xz systemtap-steved-42e740602dbb7960e11b0bbf9053e95e8a1cb1e5.zip |
Merge commit 'origin/master' into pr4225
* commit 'origin/master': (34 commits)
PR5049: fix overbroad effects of naive "*" prefixing; instead use optional "*/" only.
stap-serverd was incorectly determining that the server could
stapprobes man page: clarify statement(NUM).absolute and process("path") searching
PR5049: prefix with "*" any filenames given in "fn@filename:line" probes
Indentation fix.
Redirect stderr gets redircted so warnings don't let example script run fail.
PR6835. io/io_submit.stp: Fix #! start. Convert to normal line-ending.
PR2895. Add proper #! /usr/bin/env stap line. Make example scripts executable.
Use INSTALL_PROGRAM, not INSTALL_DATA for executable .stp scripts.
example index: only warn if old, do not regenerate
Start/stop the systemtap server from systemtap.exp and not in the top level Makefile.
Lower statement wildcard test matching threshold.
Moved details of utrace detach to stap_utrace_detach().
Saves thread vma information.
Always generate examples indexes and install examples from srcdir.
Refer to srcdir spec file Makefile so make rpm works when builddir != srcdir.
Add index of subsystem and keywords at top of HTML indexes.
Don't output output, exits, status line in indexes (mentioned in descriptions).
Disable chmodding of samples/kmalloc-top in spec file since it isn't installed.
Make sure examples indexes are always generated in builddir.
...
Diffstat (limited to 'testsuite/systemtap.base/itrace.exp')
-rw-r--r-- | testsuite/systemtap.base/itrace.exp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/itrace.exp b/testsuite/systemtap.base/itrace.exp new file mode 100644 index 00000000..f19af977 --- /dev/null +++ b/testsuite/systemtap.base/itrace.exp @@ -0,0 +1,106 @@ +# itrace test + +# temporarily disabled +return + + +# 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 +} 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 +} 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 |