diff options
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/onoffprobe.exp | 57 | ||||
-rw-r--r-- | testsuite/systemtap.base/onoffprobe.stp | 35 |
2 files changed, 92 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/onoffprobe.exp b/testsuite/systemtap.base/onoffprobe.exp new file mode 100644 index 00000000..41e107d7 --- /dev/null +++ b/testsuite/systemtap.base/onoffprobe.exp @@ -0,0 +1,57 @@ +set test "onoffprobe" +if {![installtest_p]} { untested $test; return } + +spawn stap $srcdir/$subdir/$test.stp -m $test +set pid $spawn_id +set ok 0 +expect { + -timeout 240 + "begin probed\r\n" { + if {$ok == 0} { + incr ok + pass "conditional begin probe" + exec echo 1 > /proc/systemtap/$test/switch + exec echo "dummy" > /dev/null + exp_continue; + } + } + "function return probed\r\n" { + if {$ok == 1} { + incr ok + pass "conditional dwarf probe (return)" + exec echo 2 > /proc/systemtap/$test/switch + exec echo "dummy" > /dev/null + exp_continue; + } + } + "function entry probed\r\n" { + if {$ok == 2} { + incr ok + pass "conditional dwarf probe (entry)" + exec echo 3 > /proc/systemtap/$test/switch + exp_continue; + } + } + "timer probed\r\n" { + if {$ok == 3} { + incr ok + pass "conditional timer probe" + exec echo 4 > /proc/systemtap/$test/switch + exp_continue; + } + } + "profile probed\r\n" { + if {$ok == 4} { + incr ok + pass "conditional profile probe" + } + } + timeout { fail "$test (timeout)" } + eof { } +} +send "\003" +#FIXME does not handle case of hanging pfaults.stp correctly +wait +exec rm -f $test.ko +if {$ok != 5} {fail "conditional probes ($ok)"} + diff --git a/testsuite/systemtap.base/onoffprobe.stp b/testsuite/systemtap.base/onoffprobe.stp new file mode 100644 index 00000000..11968540 --- /dev/null +++ b/testsuite/systemtap.base/onoffprobe.stp @@ -0,0 +1,35 @@ +global switch=0 + +#begin probe +probe begin if (switch==0) { + log("begin probed\n"); +} + +#dwarf probe (return) +probe kernel.function("sys_write").return if (switch == 1) { + log("function return probed\n") + switch = 0 +} + +#dwarf probe (entry) +probe kernel.function("sys_write") if (switch == 2) { + log("function entry probed\n") + switch = 0 +} + +#timer probe +probe timer.s(1) if (switch == 3) { + log("timer probed\n") + switch = 0 +} + +#profile probe +probe timer.profile if (switch == 4) { + log("profile probed\n") + switch = 0 +} + +probe procfs("switch").write { + switch = strtol($value, 10) +} + |