summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.context
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.context')
-rw-r--r--testsuite/systemtap.context/args.tcl2
-rw-r--r--testsuite/systemtap.context/backtrace.stp2
-rw-r--r--testsuite/systemtap.context/backtrace.tcl14
-rw-r--r--testsuite/systemtap.context/context.exp18
-rw-r--r--testsuite/systemtap.context/pid.tcl2
-rw-r--r--testsuite/systemtap.context/systemtap_test_module2.c10
6 files changed, 35 insertions, 13 deletions
diff --git a/testsuite/systemtap.context/args.tcl b/testsuite/systemtap.context/args.tcl
index 6c14c4b7..37a43823 100644
--- a/testsuite/systemtap.context/args.tcl
+++ b/testsuite/systemtap.context/args.tcl
@@ -1,4 +1,4 @@
-spawn stap args.stp
+spawn stap $srcdir/$subdir/args.stp
expect {
-timeout 240
"READY" {
diff --git a/testsuite/systemtap.context/backtrace.stp b/testsuite/systemtap.context/backtrace.stp
index 73781371..c14d071c 100644
--- a/testsuite/systemtap.context/backtrace.stp
+++ b/testsuite/systemtap.context/backtrace.stp
@@ -4,7 +4,7 @@ function print_all_trace_info(point:string) {
print("--------\n")
bt = backtrace()
printf("the %s stack is %s\n", point, bt)
- print("--------\n")
+ printf("--<%s>--\n", point)
print_stack(bt);
print("--------\n")
}
diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl
index e35832ee..703f0ec2 100644
--- a/testsuite/systemtap.context/backtrace.tcl
+++ b/testsuite/systemtap.context/backtrace.tcl
@@ -5,7 +5,13 @@ set m4 0
set m5 0
set m6 0
-spawn stap backtrace.stp
+if {[istarget ia64-*-*]} {
+ set retexp {.*return\>--\r\n 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n}
+} else {
+ set retexp {.*return\>--\r\n 0x[a-f0-9]+ : kretprobe_trampoline_holder[^\r\n]+\r\n}
+}
+
+spawn stap $srcdir/$subdir/backtrace.stp
#exp_internal 1
expect {
-timeout 240
@@ -36,7 +42,7 @@ expect {
incr m2
expect {
-timeout 5
- -re {.*---\r\n 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {.*call\>--\r\n 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
if {$m2 == 1} {incr m2}
exp_continue
}
@@ -76,7 +82,7 @@ expect {
incr m4
expect {
-timeout 5
- -re {.*0x[a-f0-9]+ : kretprobe_trampoline_holder[^\[]+\[\]\r\n} {
+ -re $retexp {
if {$m4 == 1} {incr m4}
exp_continue
}
@@ -104,7 +110,7 @@ expect {
incr m6
expect {
-timeout 5
- -re {.*---\r\n 0x[a-f0-9]+[^\r\n]+\r\n} {
+ -re {.*profile>--\r\n 0x[a-f0-9]+[^\r\n]+\r\n} {
if {$m6 == 1} {incr m6}
}
}
diff --git a/testsuite/systemtap.context/context.exp b/testsuite/systemtap.context/context.exp
index bc5f8ebe..11c0f2fc 100644
--- a/testsuite/systemtap.context/context.exp
+++ b/testsuite/systemtap.context/context.exp
@@ -21,20 +21,21 @@ proc cleanup {} {
proc build_modules {} {
global build_dir
+ global srcdir subdir
if {[catch {exec mktemp -d staptestXXXXX} build_dir]} {
puts stderr "Failed to create temporary directory: $build_dir"
return 0
}
- foreach f [glob systemtap_test_module*.c] {
+ foreach f [glob $srcdir/$subdir/systemtap_test_module*.c] {
exec cp $f $build_dir
}
set old_dir [pwd]
cd $build_dir
foreach n {2 1} {
- exec cp $old_dir/makefile$n Makefile
+ exec cp $srcdir/$subdir/makefile$n Makefile
if {[catch {exec make clean} res]} {
puts $res
cd $old_dir
@@ -61,7 +62,13 @@ proc build_modules {} {
}
# first build the modules
-cd $srcdir/$subdir
+
+# NB: We cannot "cd" on behalf the whole dejagnu process, especially
+# without going back to the build tree, and especially not to the
+# source tree expecting to be able to write there.
+#
+# cd $srcdir/$subdir
+
set uname [exec /bin/uname -r]
if {[build_modules] == 0} {
@@ -73,9 +80,8 @@ if {[build_modules] == 0} {
}
foreach test $testlist {
- source $test.tcl
+ source $srcdir/$subdir/$test.tcl
}
-
-
+cleanup
diff --git a/testsuite/systemtap.context/pid.tcl b/testsuite/systemtap.context/pid.tcl
index c96d922f..a2c091f1 100644
--- a/testsuite/systemtap.context/pid.tcl
+++ b/testsuite/systemtap.context/pid.tcl
@@ -1,5 +1,5 @@
set tests [list execname pexecname pid ppid tid uid euid gid egid]
-spawn stap pid.stp
+spawn stap $srcdir/$subdir/pid.stp
#exp_internal 1
expect {
-timeout 240
diff --git a/testsuite/systemtap.context/systemtap_test_module2.c b/testsuite/systemtap.context/systemtap_test_module2.c
index 51cb58bb..b0d47428 100644
--- a/testsuite/systemtap.context/systemtap_test_module2.c
+++ b/testsuite/systemtap.context/systemtap_test_module2.c
@@ -22,19 +22,23 @@
/* some nested functions to test backtraces */
int noinline yyy_func4 (int foo) {
+ asm ("");
return foo + 1;
}
int noinline yyy_func3 (int foo) {
foo = yyy_func4(foo);
+ asm ("");
return foo + 1;
}
int noinline yyy_func2 (int foo) {
foo = yyy_func3(foo);
+ asm ("");
return foo + 1;
}
int noinline yyy_func1 (int foo) {
foo = yyy_func2(foo);
+ asm ("");
return foo + 1;
}
EXPORT_SYMBOL(yyy_func1);
@@ -42,31 +46,37 @@ EXPORT_SYMBOL(yyy_func1);
/* 1. int argument testing */
int noinline yyy_int(int a, int b, int c)
{
+ asm ("");
return a+b+c;
}
/* 2. uint argument testing */
unsigned noinline yyy_uint(unsigned a, unsigned b, unsigned c)
{
+ asm ("");
return a+b+c;
}
/* 3. long argument testing */
long noinline yyy_long(long a, long b, long c)
{
+ asm ("");
return a+b+c;
}
/* 4. int64_t argument testing */
int noinline yyy_int64(int64_t a, int64_t b, int64_t c)
{
+ asm ("");
return a+b+c;
}
/* 5. char argument testing */
char noinline yyy_char(char a, char b, char c)
{
+ asm ("");
return 'Q';
}
/* 5. string argument testing */
char * noinline yyy_str(char *a, char *b, char *c)
{
+ asm ("");
return "XYZZY";
}