[PATCH 2/4] add cases for condition compile

Zhou Wenjian zhouwj-fnst@cn.fujitsu.com
Fri Nov 13 09:26:00 GMT 2015


	* testsuite/systemtap.base/cond_compile.exp: New test case
	* testsuite/systemtap.base/cond_compile.stp: New test file
---
 testsuite/systemtap.base/cond_compile.exp |  9 +++++++++
 testsuite/systemtap.base/cond_compile.stp | 33 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100755 testsuite/systemtap.base/cond_compile.exp
 create mode 100755 testsuite/systemtap.base/cond_compile.stp

diff --git a/testsuite/systemtap.base/cond_compile.exp b/testsuite/systemtap.base/cond_compile.exp
new file mode 100755
index 0000000..654708a
--- /dev/null
+++ b/testsuite/systemtap.base/cond_compile.exp
@@ -0,0 +1,9 @@
+# Check condition compile
+
+set test "cond_compile"
+if {![installtest_p]} { untested "$test"; return }
+
+set result_string {arg==2015
+arg==2015
+arg!=2014}
+stap_run3 "$test" $srcdir/$subdir/$test.stp 2015
diff --git a/testsuite/systemtap.base/cond_compile.stp b/testsuite/systemtap.base/cond_compile.stp
new file mode 100755
index 0000000..481deb3
--- /dev/null
+++ b/testsuite/systemtap.base/cond_compile.stp
@@ -0,0 +1,33 @@
+/*
+ * cond_compile.stp
+ *
+ * Check condition compile
+ */
+
+probe begin {
+    %(
+     $1==2015%?
+     {printf("arg==2015\n")}
+    %)
+
+    %(
+     $1==2014%?
+     {printf("arg==2014\n")}
+    %)
+
+    %(
+     $1==2015%?
+     {printf("arg==2015\n")}
+    %:
+     {printf("arg!=2015\n")}
+    %)
+
+    %(
+     $1==2014%?
+     {printf("arg==2014\n")}
+    %:
+     {printf("arg!=2014\n")}
+    %)
+
+    exit()
+}
-- 
1.8.3.1



More information about the Systemtap mailing list