summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/tracepoints.exp23
-rw-r--r--testsuite/systemtap.base/uprobes_exe.c27
-rw-r--r--testsuite/systemtap.base/uprobes_lib.c20
-rw-r--r--testsuite/systemtap.base/uprobes_lib.exp38
-rw-r--r--testsuite/systemtap.base/uprobes_lib.stp9
5 files changed, 117 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/tracepoints.exp b/testsuite/systemtap.base/tracepoints.exp
index bea461c4..cd033908 100644
--- a/testsuite/systemtap.base/tracepoints.exp
+++ b/testsuite/systemtap.base/tracepoints.exp
@@ -1,3 +1,26 @@
+
+set tracepoints {}
+spawn stap -l {kernel.trace("*")}
+expect {
+ -re {^kernel.trace[^\r\n]*\r\n} {
+ append tracepoints $expect_out(0,string)
+ exp_continue
+ }
+ timeout {}
+ eof {}
+}
+catch {close}; catch { wait }
+
+foreach tp $tracepoints {
+ set test "tracepoint $tp -p4"
+ if {[catch {exec stap -w -p4 -e "probe $tp {}"} res]} {
+ fail "$test $res"
+ } else {
+ pass "$test"
+ }
+}
+
set test "tracepoints"
+if {![installtest_p]} { untested $test; return }
set ::result_string {tracepoints OK}
stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.base/uprobes_exe.c b/testsuite/systemtap.base/uprobes_exe.c
new file mode 100644
index 00000000..447434c6
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_exe.c
@@ -0,0 +1,27 @@
+/* uprobes_lib test case
+ * Copyright (C) 2009, Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+#include <unistd.h>
+
+// function from our library
+int lib_main (void);
+
+void
+main_func (int foo)
+{
+ ; // nothing here...
+}
+
+int
+main (int argc, char *argv[], char *envp[])
+{
+ main_func(1);
+ lib_main();
+ return 0;
+}
diff --git a/testsuite/systemtap.base/uprobes_lib.c b/testsuite/systemtap.base/uprobes_lib.c
new file mode 100644
index 00000000..c9d70625
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.c
@@ -0,0 +1,20 @@
+/* uprobes_lib test case - library helper
+ * Copyright (C) 2009, Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+void
+lib_func (int bar)
+{
+ ; // nothing here...
+}
+
+void
+lib_main ()
+{
+ lib_func (3);
+}
diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp
new file mode 100644
index 00000000..ae1b72e8
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.exp
@@ -0,0 +1,38 @@
+set test "uprobes_lib"
+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"
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "$test"; return }
+
+# 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 "unable to compile $testsrclib"
+ return
+}
+set res [target_compile $testsrc $testexe executable $maintestflags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "unable to compile $testsrc"
+ return
+}
+
+# XXX main_func needs another/extra test. Disabled for now.
+# Enable (and in uprobes_lib.stp) after PR9940 is fixed.
+# set ::result_string {main_func
+# lib_func}
+set ::result_string {lib_func}
+
+stap_run2 $srcdir/$subdir/$test.stp -c $testexe
+
+#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.base/uprobes_lib.stp b/testsuite/systemtap.base/uprobes_lib.stp
new file mode 100644
index 00000000..bc6cc249
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.stp
@@ -0,0 +1,9 @@
+/* - Not activated probe... Seems always skipped?
+probe process("uprobes_exe").function("main_func") {
+ printf("main_func\n");
+}
+*/
+
+probe process("libuprobes_lib.so").function("lib_func") {
+ printf("lib_func\n");
+}