summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>2008-10-28 16:13:01 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-10-28 16:13:01 -0400
commit3cec42574e444b7f91e2d887527bea45348ffb79 (patch)
tree658f46bbca4cd663d25e751d47ba5551582fd009
parentd4b35e96eab28e96353b53954111662cf76ced2d (diff)
downloadsystemtap-steved-3cec42574e444b7f91e2d887527bea45348ffb79.tar.gz
systemtap-steved-3cec42574e444b7f91e2d887527bea45348ffb79.tar.xz
systemtap-steved-3cec42574e444b7f91e2d887527bea45348ffb79.zip
PR5274: uretprobe vs. longjmp support
-rw-r--r--testsuite/ChangeLog5
-rwxr-xr-xtestsuite/systemtap.base/bz5274.a.stp16
-rw-r--r--testsuite/systemtap.base/bz5274.c44
-rwxr-xr-xtestsuite/systemtap.base/bz5274.exp50
-rw-r--r--testsuite/systemtap.base/bz5274.exp_out12
-rwxr-xr-xtestsuite/systemtap.base/bz5274.sh2
-rwxr-xr-xtestsuite/systemtap.base/bz5274.stp8
7 files changed, 137 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index e27121ce..b0abb38c 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-28 Frank Ch. Eigler <fche@elastic.org>
+
+ From Srikar Dronamraju <srikar@linux.vnet.ibm.com>:
+ * systemtap.base/bz5274.*: New tests.
+
2008-10-28 David Smith <dsmith@redhat.com>
* buildok/vfs_testcase.stp: Fixes for updated vfs tapset.
diff --git a/testsuite/systemtap.base/bz5274.a.stp b/testsuite/systemtap.base/bz5274.a.stp
new file mode 100755
index 00000000..1d3aefc0
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.a.stp
@@ -0,0 +1,16 @@
+#! /bin/env stap
+probe process("./bz5274").function("funcb").call,
+ process("./bz5274").function("funcc").call,
+ process("./bz5274").function("funcd").call
+{
+ printf("%s Entering %s\n", pp(), thread_indent(1))
+}
+
+
+probe process("./bz5274").function("funcb").return,
+ process("./bz5274").function("funcc").return,
+ process("./bz5274").function("funcd").return
+{
+ printf("%s %s returns %s\n", pp(), thread_indent(-1), returnstr(2))
+}
+
diff --git a/testsuite/systemtap.base/bz5274.c b/testsuite/systemtap.base/bz5274.c
new file mode 100644
index 00000000..4e4cfb16
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.c
@@ -0,0 +1,44 @@
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void funcd(int i, jmp_buf env)
+{
+ printf("In %s: %s :%d : i=%d. Calling longjmp\n", "bz5274.c",__func__,__LINE__,i);
+ longjmp(env, i);
+}
+
+void funcc(int i, jmp_buf env)
+{
+ printf("In %s: %s :%d : i=%d. Calling funcd\n", "bz5274.c",__func__,__LINE__,i);
+ funcd(i,env);
+}
+
+
+void funcb(int i, jmp_buf env)
+{
+ printf("In %s: %s :%d : i=%d. Calling funcc\n", "bz5274.c",__func__,__LINE__,i);
+ funcc(i,env);
+}
+
+
+void funca(char *s, jmp_buf env)
+{
+ int i;
+
+ i = setjmp(env);
+ if (i == 4)
+ return;
+ funcb(++i, env);
+ return;
+}
+
+
+
+int main(int argc, char **argv)
+{
+ jmp_buf env;
+
+ funca("Hello World", env);
+ exit(0);
+}
diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp
new file mode 100755
index 00000000..6e95a58b
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.exp
@@ -0,0 +1,50 @@
+set test "./bz5274"
+set tpath "$srcdir/$subdir/$test"
+set arch [exec uname -m]
+
+if {$arch == "ppc64"} {
+ catch {exec gcc -o $test -g -m64 $srcdir/$subdir/$test.c} err
+} else {
+ catch {exec gcc -o $test -g $srcdir/$subdir/$test.c} err
+}
+
+
+if {$err == "" && [file exists $test]} then { pass "$test compile"
+} else {fail "$test compile"}
+
+if {! [installtest_p]} { untested "$test -p5"; return }
+
+
+if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} {
+ untested "$test longjmp to a uretprobed function"
+ puts "$res"
+ # catch {exec rm -f $test.out}
+} else {
+ if {[catch {exec cmp $test.out $srcdir/$subdir/$test.exp_out} res]} {
+ fail "$test longjmp to a uretprobed function"
+ puts "$res"
+# catch {exec rm -f $test.out}
+ } else {
+ pass "$test longjmp to a uretprobed function"
+ # catch {exec rm -f $test.out}
+ }
+}
+
+if {[catch {exec stap $tpath.a.stp -c $srcdir/$subdir/$test.sh} res]} {
+ untested "$test longjmp to a non-uretprobed function"
+ puts "$res"
+ catch {exec rm -f $test.out $test}
+ return
+} else {
+ if {[catch {exec cmp $test.out $srcdir/$subdir/$test.exp_out} res]} {
+ fail "$test longjmp to a non-uretprobed function"
+ puts "$res"
+ catch {exec rm -f $test.out $test}
+ return
+ } else {
+ pass "$test longjmp to a non-uretprobed function"
+ catch {exec rm -f $test.out $test}
+ }
+}
+
+
diff --git a/testsuite/systemtap.base/bz5274.exp_out b/testsuite/systemtap.base/bz5274.exp_out
new file mode 100644
index 00000000..a52fac1d
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.exp_out
@@ -0,0 +1,12 @@
+In bz5274.c: funcb :20 : i=1. Calling funcc
+In bz5274.c: funcc :13 : i=1. Calling funcd
+In bz5274.c: funcd :7 : i=1. Calling longjmp
+In bz5274.c: funcb :20 : i=2. Calling funcc
+In bz5274.c: funcc :13 : i=2. Calling funcd
+In bz5274.c: funcd :7 : i=2. Calling longjmp
+In bz5274.c: funcb :20 : i=3. Calling funcc
+In bz5274.c: funcc :13 : i=3. Calling funcd
+In bz5274.c: funcd :7 : i=3. Calling longjmp
+In bz5274.c: funcb :20 : i=4. Calling funcc
+In bz5274.c: funcc :13 : i=4. Calling funcd
+In bz5274.c: funcd :7 : i=4. Calling longjmp
diff --git a/testsuite/systemtap.base/bz5274.sh b/testsuite/systemtap.base/bz5274.sh
new file mode 100755
index 00000000..86a734ea
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.sh
@@ -0,0 +1,2 @@
+#! /bin/bash
+./bz5274 > ./bz5274.out
diff --git a/testsuite/systemtap.base/bz5274.stp b/testsuite/systemtap.base/bz5274.stp
new file mode 100755
index 00000000..b3e26d83
--- /dev/null
+++ b/testsuite/systemtap.base/bz5274.stp
@@ -0,0 +1,8 @@
+#! /bin/env stap
+probe process("./bz5274").function("*").call {
+ printf("%s Entering %s\n", pp(), thread_indent(1))
+}
+probe process("./bz5274").function("*").return {
+ printf("%s %s returns %s\n", pp(), thread_indent(-1), returnstr(2))
+}
+