summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-04-21 20:01:00 +0200
committerMark Wielaard <mjw@redhat.com>2009-04-21 20:01:00 +0200
commit192d5136bbfcd1e61c2f17cc52df875a954d24ec (patch)
tree27dd76c7386e5b8d177756ad8175e5b700f8541a /testsuite
parent41d9243cc9d107d1980e18537090ed358dc7920a (diff)
parent7d7f074398802c84f544e263995ce15874b9f408 (diff)
downloadsystemtap-steved-192d5136bbfcd1e61c2f17cc52df875a954d24ec.tar.gz
systemtap-steved-192d5136bbfcd1e61c2f17cc52df875a954d24ec.tar.xz
systemtap-steved-192d5136bbfcd1e61c2f17cc52df875a954d24ec.zip
Merge branch 'user_unwind'
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/buildok/ustack.stp10
-rw-r--r--testsuite/systemtap.base/uprobes_ustack.exp94
-rw-r--r--testsuite/systemtap.base/uprobes_ustack.stp35
-rw-r--r--testsuite/systemtap.context/backtrace.tcl1
4 files changed, 140 insertions, 0 deletions
diff --git a/testsuite/buildok/ustack.stp b/testsuite/buildok/ustack.stp
new file mode 100755
index 00000000..23af0bff
--- /dev/null
+++ b/testsuite/buildok/ustack.stp
@@ -0,0 +1,10 @@
+#! stap -p4
+#
+# Test the translatability for ubacktrace(), print_ustack()
+# and print_ubacktrace()
+#
+probe begin
+{
+ print_ustack(ubacktrace());
+ print_ubacktrace();
+}
diff --git a/testsuite/systemtap.base/uprobes_ustack.exp b/testsuite/systemtap.base/uprobes_ustack.exp
new file mode 100644
index 00000000..f085fc16
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_ustack.exp
@@ -0,0 +1,94 @@
+set test "uprobes_ustack"
+set testpath "$srcdir/$subdir"
+set testsrc "$testpath/uprobes_exe.c"
+set testsrclib "$testpath/uprobes_lib.c"
+set testexe "./uprobes_exe"
+set testlibname "uprobes_lib"
+set testlibdir "."
+set testso "$testlibdir/lib${testlibname}.so"
+set testflags "additional_flags=-g additional_flags=-O"
+set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
+set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
+
+# Compile our test program and library.
+set res [target_compile $testsrclib $testso executable $testlibflags]
+if { $res != "" } {
+ verbose "target_compile for $testso failed: $res" 2
+ fail "$test compile $testsrclib"
+ return
+} else {
+ pass "$test compile $testsrclib"
+}
+
+set res [target_compile $testsrc $testexe executable $maintestflags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "$test compile $testsrc"
+ return
+} else {
+ pass "$test compile $testsrc"
+}
+
+set ::result_string {exe: main=main
+exe: main_func=main_func
+exe: main_func=main_func
+exe: main_func=main_func
+lib: lib_main=lib_main
+lib: lib_func=lib_func
+lib: lib_func=lib_func
+lib: lib_func=lib_func}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "$test"; return }
+if {! [utrace_p]} { untested $test; return }
+
+# Output is:
+#print_ubacktrace exe 0
+# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ustack exe 1
+# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ubacktrace lib 2
+# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
+# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
+# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ustack lib 3
+# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
+# 0x00db2431 : lib_func+0x25/0x2b [.../libuprobes_lib.so]
+# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
+# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+
+set print 0
+set main 0
+set main_func 0
+set lib_main 0
+set lib_func 0
+spawn stap $srcdir/$subdir/$test.stp -c $testexe
+
+wait
+expect {
+ -timeout 60
+ -re {^print_[^\r\n]+\r\n} {incr print; exp_continue}
+ -re {^ 0x[a-f0-9]+ : main\+0x[^\r\n]+\r\n} {incr main; exp_continue}
+ -re {^ 0x[a-f0-9]+ : main_func\+0x[^\r\n]+\r\n} {incr main_func; exp_continue}
+ -re {^ 0x[a-f0-9]+ : lib_main\+0x[^\r\n]+\r\n} {incr lib_main; exp_continue}
+ -re {^ 0x[a-f0-9]+ : lib_func\+0x[^\r\n]+\r\n} {incr lib_func; exp_continue}
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
+if {$print == 4} {pass "$test print"} {fail "$test print ($print)"}
+if {$main == 4} {pass "$test main"} {fail "$test main ($main)"}
+if {$main_func == 9} {pass "$test main_func"} {fail "$test main_func ($main_func)"}
+if {$lib_main == 2} {pass "$test lib_main"} {fail "$test lib_main ($lib_main)"}
+if {$lib_func == 3} {pass "$test lib_func"} {fail "$test lib_func ($lib_func)"}
+
+#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.base/uprobes_ustack.stp b/testsuite/systemtap.base/uprobes_ustack.stp
new file mode 100644
index 00000000..6de03b42
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_ustack.stp
@@ -0,0 +1,35 @@
+// Prints backtrace from lib through exe twice using diffent ustack functions.
+
+global hits = 0;
+
+probe process("uprobes_exe").function("main_func")
+{
+ if (hits == 0)
+ {
+ log("print_ubacktrace exe 0");
+ print_ubacktrace();
+ hits++;
+ }
+ else if (hits == 1)
+ {
+ log("print_ustack exe 1");
+ print_ustack(ubacktrace());
+ hits++;
+ }
+}
+
+probe process("libuprobes_lib.so").function("lib_func")
+{
+ if (hits == 2)
+ {
+ log("print_ubacktrace lib 2");
+ print_ubacktrace();
+ hits++;
+ }
+ else if (hits == 3)
+ {
+ log("print_ustack lib 3");
+ print_ustack(ubacktrace());
+ hits++;
+ }
+}
diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl
index 6edda812..975e6c4d 100644
--- a/testsuite/systemtap.context/backtrace.tcl
+++ b/testsuite/systemtap.context/backtrace.tcl
@@ -5,6 +5,7 @@ set m4 0
set m5 0
set m6 0
+#spawn stap -d kernel -d systemtap_test_module1 -DMAXSTRINGLEN=256 $srcdir/$subdir/backtrace.stp
spawn stap -DMAXSTRINGLEN=256 $srcdir/$subdir/backtrace.stp
#exp_internal 1
expect {