summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.exelib
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-09-15 18:29:45 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-09-15 18:29:45 -0400
commitda23eceb71cc70668ab9dfd80d318b3837703d9d (patch)
treedcfb85f50cf035213bde1836d2167ceca00c8205 /testsuite/systemtap.exelib
parent2260f4e32eb4c0b4cc95e4bef8ccdc5dc66261af (diff)
parent24fcff20ed7a4a9f2b772c572db28ee8df49161f (diff)
downloadsystemtap-steved-da23eceb71cc70668ab9dfd80d318b3837703d9d.tar.gz
systemtap-steved-da23eceb71cc70668ab9dfd80d318b3837703d9d.tar.xz
systemtap-steved-da23eceb71cc70668ab9dfd80d318b3837703d9d.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
* 'master' of ssh://sources.redhat.com/git/systemtap: (34 commits) Update the langref copyright notice Fix some probe examples in the language reference Remove automatic authorization of servers started by root as trusted signers. docs: add abnormal termination section to PROCESSING Remove unneeded header file Get the module to sign from -p4's stdout Move --unprivileged support news to the top. Firther updates to NEWS regarding signing and unprivileged users. Authorize new certificates created for servers started by root as authorized signers. 2009-09-14 Dave Brolley <brolley@redhat.com> Allow remaining process.* probes for unprivileged users. Use the sched_switch tracepoint if available. PR10608: mark test cases untested once compilation failed Make check.exp not sleep so much in test_installcheck. Make tracepoints.exp test more efficient by running as one giant script. Only test highest optimization for exelib.exp test. Replace small exelib.exp testcases with one jumbo testcase. Remove duplicate uprobe_derived_probe code Add semaphores for use with the forthcoming sdt marker checks. Add actual pc address to semantic error about inaccessible variables. ... Conflicts: tapsets.cxx
Diffstat (limited to 'testsuite/systemtap.exelib')
-rw-r--r--testsuite/systemtap.exelib/exelib.exp12
-rw-r--r--testsuite/systemtap.exelib/libmarkunamestack.stp72
-rw-r--r--testsuite/systemtap.exelib/libmarkunamestack.tcl104
3 files changed, 184 insertions, 4 deletions
diff --git a/testsuite/systemtap.exelib/exelib.exp b/testsuite/systemtap.exelib/exelib.exp
index bd9c687e..1337d545 100644
--- a/testsuite/systemtap.exelib/exelib.exp
+++ b/testsuite/systemtap.exelib/exelib.exp
@@ -2,7 +2,11 @@
# (with gcc/g++, -O0/-O3, prelinked/pie, seperate debuginfo)
# Then runs tests with a list of execs.
-set subtestlist {lib mark uname ustack cleanup}
+# Don't enable all sub-tests by default, enable them separately when
+# you want to track down an issue.
+# Enable just the all-in-one test for regular test runs to safe time
+#set subtestlist {lib mark uname ustack cleanup}
+set subtestlist {libmarkunamestack cleanup}
proc seperate_debuginfo {elffile} {
set objcopy [list "objcopy" "--only-keep-debug"]
@@ -44,9 +48,9 @@ foreach arch $arches {
# and exploded the test search case a bit.
foreach compiler {gcc} { # Add g++
- # Just try -O0 and -O3.
- # Adding -O, -O2, -Os and mixing lib/exe is a bit overdone
- foreach opt {-O0 -O3} {
+ # Just try -O3.
+ # Adding -O0, -O, -O2, -Os and mixing lib/exe is a bit overdone
+ foreach opt {-O3} {
foreach libprelink {no yes} {
diff --git a/testsuite/systemtap.exelib/libmarkunamestack.stp b/testsuite/systemtap.exelib/libmarkunamestack.stp
new file mode 100644
index 00000000..0efbae0e
--- /dev/null
+++ b/testsuite/systemtap.exelib/libmarkunamestack.stp
@@ -0,0 +1,72 @@
+// Jumbo stp script
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
+
+# lib
+probe process(@1).function("main") {
+ printf("main\n");
+}
+
+probe process(@1).function("main_func") {
+ printf("main_func\n");
+}
+
+probe process(@2).function("lib_main") {
+ printf("lib_main\n");
+}
+
+probe process(@2).function("lib_func") {
+ printf("lib_func\n");
+}
+
+#mark
+probe process(@1).mark("main_count") {
+ printf("main_count: %d\n", $arg1);
+}
+
+probe process(@2).mark("func_count") {
+ printf("func_count: %d\n", $arg1);
+}
+
+#uname
+probe process(@1).function("*") {
+ printf("exe: %s=%s\n",probefunc(), usymname(uaddr()));
+}
+
+probe process(@2).function("*") {
+ printf("lib: %s=%s\n",probefunc(), usymname(uaddr()));
+}
+
+# ustack
+global hits = 0;
+
+probe process(@1).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(@2).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.exelib/libmarkunamestack.tcl b/testsuite/systemtap.exelib/libmarkunamestack.tcl
new file mode 100644
index 00000000..55dc10ee
--- /dev/null
+++ b/testsuite/systemtap.exelib/libmarkunamestack.tcl
@@ -0,0 +1,104 @@
+# Only run on make installcheck
+if {! [installtest_p]} { untested "libmarkunamestack-$testname"; return }
+if {! [uprobes_p]} { untested "libmarkunamestack-$testname"; return }
+
+# Big jumbo test, for tracking down bugs, use the individual tests.
+
+# Output for ustack part 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 lib 0
+set mark 0
+set uname 0
+
+set print 0
+set main 0
+set main_func 0
+set lib_main 0
+set lib_func 0
+send_log "Running: stap $srcdir/$subdir/libmarkunamestack.stp $testexe $testlib -c $testexe\n"
+spawn stap $srcdir/$subdir/libmarkunamestack.stp $testexe $testlib -c $testexe
+
+wait -i $spawn_id
+expect {
+ -timeout 60
+ -re {^print_[^\r\n]+\r\n} {incr print; exp_continue}
+
+# lib
+ -re {^main\r\n} {incr lib; exp_continue}
+ -re {^main_func\r\n} {incr lib; exp_continue}
+ -re {^lib_main\r\n} {incr lib; exp_continue}
+ -re {^lib_func\r\n} {incr lib; exp_continue}
+
+# mark
+ -re {^main_count: [1-3]\r\n} {incr mark; exp_continue}
+ -re {^func_count: [1-3]\r\n} {incr mark; exp_continue}
+
+# uname
+ -re {^exe: main=main\r\n} {incr uname; exp_continue}
+ -re {^exe: main_func=main_func\r\n} {incr uname; exp_continue}
+ -re {^lib: lib_main=lib_main\r\n} {incr uname; exp_continue}
+ -re {^lib: lib_func=lib_func\r\n} {incr uname; exp_continue}
+
+# ustack
+ -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 "libmarkunamestack-$testname (timeout)" }
+ eof { }
+}
+
+if {$lib == 8} { pass "lib-$testname" } {
+ fail "lib-$testname ($lib)"
+}
+
+if {$mark == 6} { pass "mark-$testname" } {
+ fail "mark-$testname ($mark)"
+}
+
+if {$uname == 8} { pass "uname-$testname" } {
+ fail "uname-$testname ($uname)"
+}
+
+if {$print == 4} { pass "ustack-$testname print" } {
+ fail "ustack-$testname print ($print)"
+}
+
+if {$main == 4} { pass "ustack-$testname main" } {
+ fail "ustack-$testname main ($main)"
+}
+
+if {$main_func == 9} { pass "ustack-$testname main_func" } {
+ fail "ustack-$testname main_func ($main_func)"
+}
+
+if {$lib_main == 2} { pass "ustack-$testname lib_main" } {
+ fail "ustack-$testname lib_main ($lib_main)"
+}
+
+if {$lib_func == 3} { pass "ustack-$testname lib_func" } {
+ fail "ustack-$testname lib_func ($lib_func)"
+}