summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorhiramatu <hiramatu>2007-12-05 20:02:01 +0000
committerhiramatu <hiramatu>2007-12-05 20:02:01 +0000
commitdfd11cc3ea340096a2829f5ecda29998c73a0acb (patch)
treeba66a58789f0df1006a1ece1c616b2b38b15d29a /testsuite
parent0c218afb69ed53355a69e4264cbc5584908d65b4 (diff)
downloadsystemtap-steved-dfd11cc3ea340096a2829f5ecda29998c73a0acb.tar.gz
systemtap-steved-dfd11cc3ea340096a2829f5ecda29998c73a0acb.tar.xz
systemtap-steved-dfd11cc3ea340096a2829f5ecda29998c73a0acb.zip
2007-12-05 Masami Hiramatsu <mhiramat@redhat.com>
PR 4935 * tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Allow user to access kernel variables in the condition of probe points. * stapprobes.5.in : Document the conditional probe point. * NEWS : Ditto. * parseok/five.stp: Add an example of conditional probe point. * parseko/probepoint04.stp: New test for conditional probe point. * parseko/probepoint05.stp: Ditto. * parseko/probepoint06.stp: Ditto. * parseko/probepoint07.stp: Ditto. * parseko/probepoint08.stp: Ditto. * parseko/probepoint09.stp: Ditto. * semok/twentynine.stp: Ditto. * semko/thirtynine.stp: Ditto. * systemtap.base/onoffprobe.*: Ditto.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog14
-rw-r--r--testsuite/parseko/probepoint04.stp4
-rw-r--r--testsuite/parseko/probepoint05.stp4
-rw-r--r--testsuite/parseko/probepoint06.stp4
-rw-r--r--testsuite/parseko/probepoint07.stp4
-rw-r--r--testsuite/parseko/probepoint08.stp4
-rw-r--r--testsuite/parseko/probepoint09.stp4
-rwxr-xr-xtestsuite/parseok/five.stp1
-rwxr-xr-xtestsuite/semko/thirtynine.stp3
-rw-r--r--testsuite/semok/twentynine.stp20
-rw-r--r--testsuite/systemtap.base/onoffprobe.exp57
-rw-r--r--testsuite/systemtap.base/onoffprobe.stp35
12 files changed, 154 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 843dd90e..e8fa907f 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2007-12-05 Masami Hiramatsu <mhiramat@redhat.com>
+
+ PR 4935
+ * parseok/five.stp: Add an example of conditional probe point.
+ * parseko/probepoint04.stp: New test for conditional probe point.
+ * parseko/probepoint05.stp: Ditto.
+ * parseko/probepoint06.stp: Ditto.
+ * parseko/probepoint07.stp: Ditto.
+ * parseko/probepoint08.stp: Ditto.
+ * parseko/probepoint09.stp: Ditto.
+ * semok/twentynine.stp: Ditto.
+ * semko/thirtynine.stp: Ditto.
+ * systemtap.base/onoffprobe.*: Ditto.
+
2007-12-03 Masami Hiramatsu <mhiramat@redhat.com>
PR 5376
diff --git a/testsuite/parseko/probepoint04.stp b/testsuite/parseko/probepoint04.stp
new file mode 100644
index 00000000..754c9e63
--- /dev/null
+++ b/testsuite/parseko/probepoint04.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1)?
diff --git a/testsuite/parseko/probepoint05.stp b/testsuite/parseko/probepoint05.stp
new file mode 100644
index 00000000..11464ae2
--- /dev/null
+++ b/testsuite/parseko/probepoint05.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1)(10)
diff --git a/testsuite/parseko/probepoint06.stp b/testsuite/parseko/probepoint06.stp
new file mode 100644
index 00000000..ebe23514
--- /dev/null
+++ b/testsuite/parseko/probepoint06.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe if (1) foo(5)
diff --git a/testsuite/parseko/probepoint07.stp b/testsuite/parseko/probepoint07.stp
new file mode 100644
index 00000000..1f240a02
--- /dev/null
+++ b/testsuite/parseko/probepoint07.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1(
diff --git a/testsuite/parseko/probepoint08.stp b/testsuite/parseko/probepoint08.stp
new file mode 100644
index 00000000..a0ec712f
--- /dev/null
+++ b/testsuite/parseko/probepoint08.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if
diff --git a/testsuite/parseko/probepoint09.stp b/testsuite/parseko/probepoint09.stp
new file mode 100644
index 00000000..a7bf15d8
--- /dev/null
+++ b/testsuite/parseko/probepoint09.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if(1) bar(2)
diff --git a/testsuite/parseok/five.stp b/testsuite/parseok/five.stp
index e1b5d94a..a226dfe2 100755
--- a/testsuite/parseok/five.stp
+++ b/testsuite/parseok/five.stp
@@ -19,3 +19,4 @@ probe resource.freemembelow(50) {} # pages?
probe begin {}
probe something?, or?, nothing? {}
probe something!, or, nothing!, and?, zoo {}
+probe something? if (ture), or, nothing! if (false), then* if (0) {}
diff --git a/testsuite/semko/thirtynine.stp b/testsuite/semko/thirtynine.stp
new file mode 100755
index 00000000..6d0e6982
--- /dev/null
+++ b/testsuite/semko/thirtynine.stp
@@ -0,0 +1,3 @@
+#! stap -p2
+
+probe kernel.function("sys_open").if(1) {} /* if statement doesn't need '.'*/
diff --git a/testsuite/semok/twentynine.stp b/testsuite/semok/twentynine.stp
new file mode 100644
index 00000000..6fe308f2
--- /dev/null
+++ b/testsuite/semok/twentynine.stp
@@ -0,0 +1,20 @@
+#! stap -p2
+global p
+function dummy:long () {return p;}
+
+# alias with a condition
+probe alias0 = begin if (3) {p=1}
+# alias with a kernel-variable condition
+probe alias1 = kernel.function("sys_read").return if ($return) {p=0}
+# alias with a function-call condition
+probe blias0 = timer.s(1) if (dummy()) {p=10}
+
+# multiple probe point with conditions
+probe alias2 = alias0 if (1), alias1 if (-1) {p=2}
+
+# wildcard with a global-variable condition
+probe *lias0 if (p) {print(p)}
+
+# multi level alias with a condition
+probe alias2 if(4) {print(p)}
+
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)
+}
+