diff options
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/badkprobe.exp | 1 | ||||
-rwxr-xr-x | testsuite/systemtap.base/bz5274.exp | 8 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.exp | 9 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 139 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.stp | 14 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes.exp | 9 |
6 files changed, 136 insertions, 44 deletions
diff --git a/testsuite/systemtap.base/badkprobe.exp b/testsuite/systemtap.base/badkprobe.exp index 1a1dbad5..efc06695 100644 --- a/testsuite/systemtap.base/badkprobe.exp +++ b/testsuite/systemtap.base/badkprobe.exp @@ -5,6 +5,7 @@ if {! [installtest_p]} { untested $test; return } spawn stap -g -w -e "$script" expect { + -timeout 60 -re "^WARNING: probe .*registration error.*" { pass $test } eof { fail "$test (eof)" } timeout { fail "$test (timeout)" } diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index 6e95a58b..db0e0a46 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -14,6 +14,14 @@ if {$err == "" && [file exists $test]} then { pass "$test compile" if {! [installtest_p]} { untested "$test -p5"; 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 -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 b06b1696..73fedc8a 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -3,6 +3,15 @@ set test bz6850 catch {exec gcc -g -o bz6850 $srcdir/$subdir/bz6850.c} err if {$err == "" && [file exists bz6850]} then { pass "$test compile" } else { fail "$test compile" } +# 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 -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" } diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 78641d3f..eb0d1c6e 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -8,28 +8,30 @@ set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags= set fp [open $sup_srcpath "w"] puts $fp " #include <stdlib.h> -#include \"sduprobes.h\" +#define USE_STAP_PROBE 1 +#include \"static_uprobes.h\" foo () { - STAP_PROBE(tstlabel,label1); + STAP_PROBE(static_uprobes,test_probe_1); } bar (int i) { if (i == 0) i = 1000; - STAP_PROBE1(tstlabel,label2,i); + STAP_PROBE1(static_uprobes,test_probe_2,i); } baz (int i, char* s) { + STAP_PROBE1(static_uprobes,test_probe_0,i); if (i == 0) i = 1000; - STAP_PROBE2(tstlabel,label3,i,s); + STATIC_UPROBES_TEST_PROBE_3(i,s); } -buz () +buz (int parm) { } @@ -39,46 +41,120 @@ main () foo(); bar(2); baz(3,\"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 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"] +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 -set ok 0 -spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp -expect { - -timeout 180 - -re {In label1 probe} { incr ok; exp_continue } - -re {In label2 probe 0x2} { incr ok; exp_continue } - -re {In label3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } +# 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 -1a -#define USE_STAP_DEBUGINFO_PROBE 1 +/USE_STAP_PROBE/d +/buz/+1 +a + DTRACE_PROBE1(static_uprobes,test_probe_4,parm); . w q -HERE " close $fp spawn sh [pwd]/static_uprobes.sh -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=$env(SYSTEMTAP_RUNTIME)/sduprobes.c" +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) +} +probe process(\"static_uprobes.x\").mark(\"test_probe_3\") +{ + printf(\"In test_probe_3 probe %#x %#x\\n\", \$arg1, \$arg2) +} +probe process(\"static_uprobes.x\").mark(\"test_probe_4\") +{ + printf(\"In test_probe_4 dtrace probe %#x\\n\", \$arg1) +} +" +close $fp + +set fp [open "[pwd]/static_uprobes.d" "w"] +puts $fp " +provider static_uprobes { + probe test_probe_1 (); + probe test_probe_2 (int i); + probe test_probe_3 (int i, char* x); + probe test_probe_4 (int i); +}; +" +close $fp +spawn dtrace -h -s [pwd]/static_uprobes.d + +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 @@ -88,16 +164,19 @@ if { $res != "" } { pass "compiling sduprobes.c -g" } -spawn stap -c $sup_exepath $srcdir/$subdir/static_uprobes.stp +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 label1 probe} { incr ok; exp_continue } - -re {In label2 probe 0x2} { incr ok; exp_continue } - -re {In label3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } + -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 } + -re {In test_probe_4 dtrace probe 0x4} { incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } wait -if {$ok == 6} { pass "$test" } { fail "$test ($ok)" } +if {$ok == 5} { pass "$test" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.base/static_uprobes.stp b/testsuite/systemtap.base/static_uprobes.stp deleted file mode 100644 index b9de197e..00000000 --- a/testsuite/systemtap.base/static_uprobes.stp +++ /dev/null @@ -1,14 +0,0 @@ -probe process("static_uprobes.x").mark("label1") -{ - printf("In label1 probe\n") -} - -probe process("static_uprobes.x").mark("label2") -{ - printf("In label2 probe %#x\n", $arg1) -} - -probe process("static_uprobes.x").mark("label3") -{ - printf("In label3 probe %#x %#x\n", $arg1, $arg2) -} diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index 408ba8c4..e8318586 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -18,6 +18,15 @@ if [file exists $path] then { pass "$test prep" } else { fail "$test prep" } catch {exec gcc -g -o jennie jennie.c} err if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { fail "$test compile" } +# 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 -p4"; untested "$test -p5"; return } + set rc [stap_run_batch $srcdir/$subdir/uprobes.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } |