]> sourceware.org Git - systemtap.git/commitdiff
PR11207: testsuite for oneline macros feature.
authorSerguei Makarov <smakarov@redhat.com>
Mon, 30 Jul 2012 15:16:38 +0000 (11:16 -0400)
committerSerguei Makarov <smakarov@redhat.com>
Mon, 30 Jul 2012 15:19:51 +0000 (11:19 -0400)
testsuite/parseko/macros02.stp [deleted file]
testsuite/parseko/macros12.stp [new file with mode: 0755]
testsuite/parseko/macros13.stp [new file with mode: 0755]
testsuite/parseko/macros14.stp [new file with mode: 0644]
testsuite/parseok/macros09.stp [new file with mode: 0755]
testsuite/parseok/macros10.stp [new file with mode: 0755]
testsuite/parseok/macros11.stp [new file with mode: 0755]
testsuite/parseok/macros12.stp [new file with mode: 0755]
testsuite/parseok/macros13.stp [new file with mode: 0644]

diff --git a/testsuite/parseko/macros02.stp b/testsuite/parseko/macros02.stp
deleted file mode 100755 (executable)
index d1034d0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#! stap -p2
-
-@define foo
diff --git a/testsuite/parseko/macros12.stp b/testsuite/parseko/macros12.stp
new file mode 100755 (executable)
index 0000000..39fd558
--- /dev/null
@@ -0,0 +1,14 @@
+#! stap -p2
+
+# use before define
+@kaprobe (begin)
+
+@define kaprobe(
+        a)
+
+%(
+        probe @a {
+              foo = 2+2
+              print(foo)
+        }
+%)   
diff --git a/testsuite/parseko/macros13.stp b/testsuite/parseko/macros13.stp
new file mode 100755 (executable)
index 0000000..4bacc98
--- /dev/null
@@ -0,0 +1,9 @@
+#! stap -p2
+
+# interpreted as empty one-line macro
+# contrast parseok/macros11.stp and parseok/macros12.stp
+@define whatemptyfoo(a,b,c)
+
+%( @a
++ @b
++ @c %) # not taken as the macro body!
diff --git a/testsuite/parseko/macros14.stp b/testsuite/parseko/macros14.stp
new file mode 100644 (file)
index 0000000..71ecafb
--- /dev/null
@@ -0,0 +1,7 @@
+#! stap -p2
+
+# "expected %( for multiline macro
+
+@define foo(bar,
+            baz)
+        this is not a good macro body
diff --git a/testsuite/parseok/macros09.stp b/testsuite/parseok/macros09.stp
new file mode 100755 (executable)
index 0000000..0d5a5f9
--- /dev/null
@@ -0,0 +1,6 @@
+#! stap -p2
+
+# empty definition
+@define foo
+
+probe begin @foo { print(42) }
diff --git a/testsuite/parseok/macros10.stp b/testsuite/parseok/macros10.stp
new file mode 100755 (executable)
index 0000000..c32acce
--- /dev/null
@@ -0,0 +1,6 @@
+#! stap -p2
+
+@define oneline(a,b) ((@a)+(@b))
+@define foo(a) @a
+
+probe @foo(begin) { print(@oneline(2,2)) }
diff --git a/testsuite/parseok/macros11.stp b/testsuite/parseok/macros11.stp
new file mode 100755 (executable)
index 0000000..da41b66
--- /dev/null
@@ -0,0 +1,15 @@
+#! stap -p2
+
+# special case of multiline macro parsing
+# note macro signature spills over multiple lines
+@define kaprobe(
+        a)
+
+%(
+        probe @a {
+              foo = 2+2
+              print(foo)
+        }
+%)   
+
+@kaprobe(begin)
diff --git a/testsuite/parseok/macros12.stp b/testsuite/parseok/macros12.stp
new file mode 100755 (executable)
index 0000000..ee9f867
--- /dev/null
@@ -0,0 +1,10 @@
+#! stap -p2
+
+@define empty(ingored)
+
+# next, a conditional -- NOT the macro body
+%( kernel_v > "3.0" %?
+   probe begin { printf("foo") }
+%:
+   probe begin { printf("bar") }
+%)
diff --git a/testsuite/parseok/macros13.stp b/testsuite/parseok/macros13.stp
new file mode 100644 (file)
index 0000000..de0ece4
--- /dev/null
@@ -0,0 +1,6 @@
+#! stap -p2
+
+@define irrelevant(foo,
+                   bar) %( what about this? %)
+
+probe begin { print("Hello, World!\n") }
This page took 0.031315 seconds and 5 git commands to generate.