diff options
Diffstat (limited to 'testsuite/systemtap.base/static_uprobes.exp')
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 34e230ac..d86fef85 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -53,11 +53,16 @@ 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 } +if {$utrace_support_found == 0} { + untested "$test" + catch {exec rm -f $sup_srcpath} + return +} set ok 0 -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\") { @@ -78,7 +83,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 (); @@ -88,20 +95,30 @@ provider static_uprobes { }; " close $fp -spawn dtrace -h -s [pwd]/static_uprobes.d +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} set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) 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 sduprobes.c -g" + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} return } else { - pass "compiling sduprobes.c -g" + pass "compiling $sup_srcpath -g" } -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +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 } @@ -117,20 +134,22 @@ wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } 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 "[pwd]/static_uprobes.cc" $sup_exepath executable $sup_flags] +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" } set ok 0 -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +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 } @@ -145,4 +164,4 @@ expect { wait if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } - +catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} |