summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-03-09 11:03:55 +0100
committerMark Wielaard <mjw@redhat.com>2009-03-09 11:08:55 +0100
commitc18b2f69080486db2b2591308ace672bdb1fe123 (patch)
tree4f52e4b37cd574b9097e854e270838516eaa16d4
parent68b7cb6fdb08707ae48c8f558278eee3b2ae5154 (diff)
downloadsystemtap-steved-c18b2f69080486db2b2591308ace672bdb1fe123.tar.gz
systemtap-steved-c18b2f69080486db2b2591308ace672bdb1fe123.tar.xz
systemtap-steved-c18b2f69080486db2b2591308ace672bdb1fe123.zip
Add new sdt.exp testcase.
* testsuite/systemtap.base/sdt.exp: New test file. * testsuite/systemtap.base/sdt.stp: Likewise. * testsuite/systemtap.base/sdt.c: Likewise.
-rw-r--r--testsuite/systemtap.base/sdt.c69
-rw-r--r--testsuite/systemtap.base/sdt.exp36
-rw-r--r--testsuite/systemtap.base/sdt.stp49
3 files changed, 154 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/sdt.c b/testsuite/systemtap.base/sdt.c
new file mode 100644
index 00000000..46f68664
--- /dev/null
+++ b/testsuite/systemtap.base/sdt.c
@@ -0,0 +1,69 @@
+#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */
+
+static void call1(int a)
+{
+ STAP_PROBE1(test, mark_a, a);
+}
+
+static void call2(int a, int b)
+{
+ STAP_PROBE2(test, mark_b, a, b);
+}
+
+static void call3(int a, int b, int c)
+{
+ STAP_PROBE3(test, mark_c, a, b, c);
+}
+
+static void call4(int a, int b, int c, int d)
+{
+ STAP_PROBE4(test, mark_d, a, b, c, d);
+}
+
+static void call5(int a, int b, int c, int d, int e)
+{
+ STAP_PROBE5(test, mark_e, a, b, c, d, e);
+}
+
+static void call6(int a, int b, int c, int d, int e, int f)
+{
+ STAP_PROBE6(test, mark_f, a, b, c, d, e, f);
+}
+
+static void call7(int a, int b, int c, int d, int e, int f, int g)
+{
+ STAP_PROBE7(test, mark_g, a, b, c, d, e, f, g);
+}
+
+static void call8(int a, int b, int c, int d, int e, int f, int g, int h)
+{
+ STAP_PROBE8(test, mark_h, a, b, c, d, e, f, g, h);
+}
+
+static void call9(int a, int b, int c, int d, int e, int f, int g, int h, int i)
+{
+ STAP_PROBE9(test, mark_i, a, b, c, d, e, f, g, h, i);
+}
+
+static void call10(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
+{
+ STAP_PROBE10(test, mark_j, a, b, c, d, e, f, g, h, i, j);
+}
+
+int
+main (int argc, char **argv)
+{
+ int a, b, c, d, e, f, g, h, i, j;
+ a = 1; b = 2; c = 3; d = 4; e = 5; f = 6; g = 7; h = 8; i = 9; j = 10;
+ call1(a);
+ call2(a, b);
+ call3(a, b, c);
+ call4(a, b, c, d);
+ call5(a, b, c, d, e);
+ call6(a, b, c, d, e, f);
+ call7(a, b, c, d, e, f, g);
+ call8(a, b, c, d, e, f, g, h);
+ call9(a, b, c, d, e, f, g, h, i);
+ call10(a, b, c, d, e, f, g, h, i, j);
+ return 0;
+}
diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp
new file mode 100644
index 00000000..ce6b9a71
--- /dev/null
+++ b/testsuite/systemtap.base/sdt.exp
@@ -0,0 +1,36 @@
+set test "sdt"
+set ::result_string {1
+1 2
+1 2 3
+1 2 3 4
+1 2 3 4 5
+1 2 3 4 5 6
+1 2 3 4 5 6 7
+1 2 3 4 5 6 7 8
+1 2 3 4 5 6 7 8 9
+1 2 3 4 5 6 7 8 9 10}
+
+set test_flags "additional_flags=-g"
+set test_flags "$test_flags additional_flags=-I$srcdir/../includes/sys"
+set test_flags "$test_flags additional_flags=-std=gnu89"
+set test_flags "$test_flags additional_flags=-Wall"
+set test_flags "$test_flags additional_flags=-Wdeclaration-after-statement"
+set test_flags "$test_flags additional_flags=-Werror"
+set res [target_compile $srcdir/$subdir/$test.c $test.prog executable $test_flags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "compiling $test.c"
+ return
+} else {
+ pass "compiling $test.c"
+}
+
+# Currently fails for any mark probe with more than 4 arguments.
+# FIXME - PR s/false/{![installtest_p]/
+if (0) {
+ stap_run2 $srcdir/$subdir/$test.stp -c ./$test.prog
+} else {
+ untested "$test"
+}
+
+catch {exec rm -f $test.prog}
diff --git a/testsuite/systemtap.base/sdt.stp b/testsuite/systemtap.base/sdt.stp
new file mode 100644
index 00000000..d2deb557
--- /dev/null
+++ b/testsuite/systemtap.base/sdt.stp
@@ -0,0 +1,49 @@
+probe process("sdt.prog").mark("mark_a")
+{
+ printf("%d\n", $arg1);
+}
+
+probe process("sdt.prog").mark("mark_b")
+{
+ printf("%d %d\n", $arg1, $arg2);
+}
+
+probe process("sdt.prog").mark("mark_c")
+{
+ printf("%d %d %d\n", $arg1, $arg2, $arg3);
+}
+
+probe process("sdt.prog").mark("mark_d")
+{
+ printf("%d %d %d %d\n", $arg1, $arg2, $arg3, $arg4);
+}
+
+probe process("sdt.prog").mark("mark_e")
+{
+ printf("%d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5);
+}
+
+probe process("sdt.prog").mark("mark_f")
+{
+ printf("%d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6);
+}
+
+probe process("sdt.prog").mark("mark_g")
+{
+ printf("%d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7);
+}
+
+probe process("sdt.prog").mark("mark_h")
+{
+ printf("%d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8);
+}
+
+probe process("sdt.prog").mark("mark_i")
+{
+ printf("%d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8, arg9);
+}
+
+probe process("sdt.prog").mark("mark_j")
+{
+ printf("%d %d %d %d %d %d %d %d %d %d\n", $arg1, $arg2, $arg3, $arg4, arg5, arg6, arg7, arg8, arg9, arg10);
+}