This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 1/3] add testcases for function definitions
- From: Zhou Wenjian <zhouwj-fnst at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Date: Thu, 26 Nov 2015 16:42:13 +0800
- Subject: [PATCH 1/3] add testcases for function definitions
- Authentication-results: sourceware.org; auth=none
* testsuite/systemtap.base/func_definition.exp: New test case.
* testsuite/systemtap.base/func_definition.stp: New test file.
---
testsuite/systemtap.base/func_definition.exp | 13 ++++++
testsuite/systemtap.base/func_definition.stp | 60 ++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
create mode 100755 testsuite/systemtap.base/func_definition.exp
create mode 100755 testsuite/systemtap.base/func_definition.stp
diff --git a/testsuite/systemtap.base/func_definition.exp b/testsuite/systemtap.base/func_definition.exp
new file mode 100755
index 0000000..65abdb5
--- /dev/null
+++ b/testsuite/systemtap.base/func_definition.exp
@@ -0,0 +1,13 @@
+# Check function definitions
+
+set test "func_definition"
+if {![installtest_p]} { untested "$test"; return }
+
+foreach runtime [get_runtime_list] {
+ if {$runtime != ""} {
+ stap_run $srcdir/$subdir/$test.stp no_load (${all_pass_string}){5} \
+ --runtime=$runtime
+ } else {
+ stap_run $srcdir/$subdir/$test.stp no_load (${all_pass_string}){5}
+ }
+}
diff --git a/testsuite/systemtap.base/func_definition.stp b/testsuite/systemtap.base/func_definition.stp
new file mode 100755
index 0000000..eaa8d94
--- /dev/null
+++ b/testsuite/systemtap.base/func_definition.stp
@@ -0,0 +1,60 @@
+/*
+ * func_definition.stp
+ *
+ * Check function definitions
+ */
+probe begin {
+ println("systemtap starting probe")
+}
+
+
+function f1(arg:long)
+{
+ if (arg == 2015)
+ println("systemtap test success")
+ else
+ printf("systemtap test failure - arg of f1:%d != 2015\n", arg)
+}
+
+function f2(arg)
+{
+ if (arg == 2015)
+ println("systemtap test success")
+ else
+ printf("systemtap test failure - arg of f2:%d != 2015\n", arg)
+}
+
+function f3:long()
+{
+ return 2015
+}
+
+function f4()
+{
+ return 2015
+}
+
+function f5()
+{
+ println("systemtap test success")
+}
+
+probe end {
+ println("systemtap ending probe")
+
+ f1(2015)
+
+ f2(2015)
+
+ if (f3() == 2015)
+ println("systemtap test success")
+ else
+ printf("systemtap test failure - return_value of f3:%d != 2015\n", f3())
+
+ if (f4() == 2015)
+ println("systemtap test success")
+ else
+ printf("systemtap test failure - return_value of f4:%d != 2015\n", f4())
+
+ f5()
+}
--
1.8.3.1