From: Serguei Makarov Date: Mon, 30 Jul 2012 15:16:38 +0000 (-0400) Subject: PR11207: testsuite for oneline macros feature. X-Git-Tag: release-2.0~238 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=05b137ec05922db854429770f96ce6a4a1501347;p=systemtap.git PR11207: testsuite for oneline macros feature. --- diff --git a/testsuite/parseko/macros02.stp b/testsuite/parseko/macros02.stp deleted file mode 100755 index d1034d0fb..000000000 --- a/testsuite/parseko/macros02.stp +++ /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 index 000000000..39fd55879 --- /dev/null +++ b/testsuite/parseko/macros12.stp @@ -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 index 000000000..4bacc98a8 --- /dev/null +++ b/testsuite/parseko/macros13.stp @@ -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 index 000000000..71ecafb90 --- /dev/null +++ b/testsuite/parseko/macros14.stp @@ -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 index 000000000..0d5a5f972 --- /dev/null +++ b/testsuite/parseok/macros09.stp @@ -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 index 000000000..c32acceb9 --- /dev/null +++ b/testsuite/parseok/macros10.stp @@ -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 index 000000000..da41b6630 --- /dev/null +++ b/testsuite/parseok/macros11.stp @@ -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 index 000000000..ee9f8676f --- /dev/null +++ b/testsuite/parseok/macros12.stp @@ -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 index 000000000..de0ece424 --- /dev/null +++ b/testsuite/parseok/macros13.stp @@ -0,0 +1,6 @@ +#! stap -p2 + +@define irrelevant(foo, + bar) %( what about this? %) + +probe begin { print("Hello, World!\n") }