diff options
Diffstat (limited to 'testsuite/systemtap.base')
-rwxr-xr-x | testsuite/systemtap.base/bz5274.exp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.exp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 185 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes.exp | 14 |
4 files changed, 123 insertions, 102 deletions
diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index db0e0a46..92441e9e 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -8,11 +8,14 @@ if {$arch == "ppc64"} { 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 {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Try to find utrace_attach symbol in /proc/kallsyms # copy from utrace_p5.exp @@ -21,7 +24,11 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p5" + return +} if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} { untested "$test longjmp to a uretprobed function" diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp index 73fedc8a..b96ed95c 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -10,12 +10,21 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p4" + untested "$test -p5" + return +} set rc [stap_run_batch $srcdir/$subdir/bz6850.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; return } +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index eb0d1c6e..6c0f83a8 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,21 +1,16 @@ + set test "sduprobes" -if {![installtest_p]} {untested $test; return} # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" set sup_exepath "[pwd]/static_uprobes.x" -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-L$env(CRASH_LIBDIR) additional_flags=-lsduprobes" set fp [open $sup_srcpath "w"] puts $fp " #include <stdlib.h> #define USE_STAP_PROBE 1 #include \"static_uprobes.h\" -foo () -{ - STAP_PROBE(static_uprobes,test_probe_1); -} - +void bar (int i) { if (i == 0) @@ -23,6 +18,7 @@ bar (int i) STAP_PROBE1(static_uprobes,test_probe_2,i); } +void baz (int i, char* s) { STAP_PROBE1(static_uprobes,test_probe_0,i); @@ -31,102 +27,31 @@ baz (int i, char* s) STATIC_UPROBES_TEST_PROBE_3(i,s); } +void buz (int parm) { + if (parm == 0) + parm = 1000; + DTRACE_PROBE1(static_uprobes,test_probe_4,parm); } +int main () { - sleep(5); - foo(); bar(2); - baz(3,\"abc\"); + baz(3,(char*)\"abc\"); buz(4); } " close $fp -# set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] -# if { $res != "" } { -# verbose "target_compile failed: $res" 2 -# fail "compiling static_uprobes.c" -# return -# } else { -# pass "compiling static_uprobes.c" -# } - -set fp [open "[pwd]/static_uprobes.stp" "w"] +set sup_stppath "[pwd]/static_uprobes.stp" +set fp [open $sup_stppath "w"] puts $fp " probe process(\"static_uprobes.x\").mark(\"test_probe_0\") { printf(\"In test_probe_0 probe %#x\\n\", \$arg1) } -probe process(\"static_uprobes.x\").mark(\"test_probe_1\") -{ - printf(\"In test_probe_1 probe\\n\") -} -probe process(\"static_uprobes.x\").mark(\"test_probe_2\") -{ - printf(\"In test_probe_2 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_3\") -{ - printf(\"In test_probe_3 probe %#x %#x\\n\", \$arg1, \$arg2) -} -" -close $fp - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { untested "$test"; return } - -set ok 0 -# verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -# spawn stap -c $sup_exepath [pwd]/static_uprobes.stp -# expect { -# -timeout 180 -# -re {In test_probe_1 probe} { incr ok; exp_continue } -# -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } -# -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } -# -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } -# timeout { fail "$test (timeout)" } -# eof { } -# } - -# if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -set ok 0 - -# Now do a debuginfo style probe of the above test - -set fp [open "[pwd]/static_uprobes.sh" "w"] -puts $fp " -ed $sup_srcpath <<HERE -/USE_STAP_PROBE/d -/buz/+1 -a - DTRACE_PROBE1(static_uprobes,test_probe_4,parm); -. -w -q -" -close $fp -spawn sh [pwd]/static_uprobes.sh - -set fp [open "[pwd]/static_uprobes.stp" "w"] -puts $fp " -probe process(\"static_uprobes.x\").mark(\"test_probe_0\") -{ - printf(\"In test_probe_0 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_1\") -{ - printf(\"In test_probe_1 probe\\n\") -} probe process(\"static_uprobes.x\").mark(\"test_probe_2\") { printf(\"In test_probe_2 probe %#x\\n\", \$arg1) @@ -142,7 +67,9 @@ probe process(\"static_uprobes.x\").mark(\"test_probe_4\") " close $fp -set fp [open "[pwd]/static_uprobes.d" "w"] +set sup_dpath "[pwd]/static_uprobes.d" +set sup_hpath "[pwd]/static_uprobes.h" +set fp [open $sup_dpath "w"] puts $fp " provider static_uprobes { probe test_probe_1 (); @@ -152,20 +79,89 @@ provider static_uprobes { }; " close $fp -spawn dtrace -h -s [pwd]/static_uprobes.d +if {[installtest_p]} { + set dtrace $env(SYSTEMTAP_PATH)/dtrace +} else { + set dtrace $srcdir/../dtrace +} +exec $dtrace -h -s $sup_dpath +if {[file exists $sup_hpath]} then { + pass "generating $sup_hpath" +} else { + fail "generating $sup_hpath" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + return +} + +catch {exec rm -f $sup_dpath} + +if {[installtest_p]} { + set sdtdir $env(SYSTEMTAP_INCLUDES) +} else { + set sdtdir $srcdir/../includes +} + +set sup_flags "additional_flags=-I$sdtdir additional_flags=-g additional_flags=-O additional_flags=-I." +set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + return +} else { + pass "compiling $sup_srcpath -g" +} -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=-I." +spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" +set sup_srcpath "[pwd]/static_uprobes.cc" +set sup_flags "$sup_flags c++" set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling sduprobes.c -g" + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} return } else { - pass "compiling sduprobes.c -g" + pass "compiling $sup_srcpath -g" +} + +if {![installtest_p]} {untested $test; return} + +# Try to find utrace_attach symbol in /proc/kallsyms +# copy from utrace_p5.exp +set utrace_support_found 0 +set path "/proc/kallsyms" +if {! [catch {exec grep -q utrace_attach $path} dummy]} { + set utrace_support_found 1 +} +if {$utrace_support_found == 0} { + untested "$test" + catch {exec rm -f $sup_srcpath} + return +} + +set ok 0 + +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath +expect { + -timeout 180 + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x4} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } } -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +wait + +if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } + +set ok 0 + +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath expect { -timeout 180 -re {In test_probe_1 probe} { incr ok; exp_continue } @@ -179,4 +175,5 @@ expect { wait -if {$ok == 5} { pass "$test" } { fail "$test ($ok)" } +if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } +catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index e8318586..89250e7b 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -25,12 +25,20 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + untested "$test -p4"; untested "$test -p5" + catch {exec rm -f jennie.c jennie} + return +} set rc [stap_run_batch $srcdir/$subdir/uprobes.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; exec rm -f jennie.c jennie; return } +if {! [installtest_p]} { + untested "$test -p5"; + catch {exec rm -f jennie.c jennie} + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] @@ -46,4 +54,4 @@ expect { if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" } catch {wait; close} -exec rm -f jennie.c jennie +catch {exec rm -f jennie.c jennie} |