| 1 |
# Only run on make installcheck |
| 2 |
if {! [installtest_p]} { untested "libmarkunamestack-$testname"; return } |
| 3 |
if {! [uprobes_p]} { untested "libmarkunamestack-$testname"; return } |
| 4 |
|
| 5 |
# Big jumbo test, for tracking down bugs, use the individual tests. |
| 6 |
|
| 7 |
# Output for ustack part is: |
| 8 |
#print_ubacktrace exe 0 |
| 9 |
# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe] |
| 10 |
# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] |
| 11 |
#print_usyms exe 1 |
| 12 |
# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe] |
| 13 |
# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] |
| 14 |
# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] |
| 15 |
#print_ubacktrace lib 2 |
| 16 |
# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so] |
| 17 |
# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so] |
| 18 |
# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe] |
| 19 |
# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] |
| 20 |
# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] |
| 21 |
# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] |
| 22 |
#print_usyms lib 3 |
| 23 |
# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so] |
| 24 |
# 0x00db2431 : lib_func+0x25/0x2b [.../libuprobes_lib.so] |
| 25 |
# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so] |
| 26 |
# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe] |
| 27 |
# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] |
| 28 |
# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe] |
| 29 |
# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe] |
| 30 |
|
| 31 |
set lib 0 |
| 32 |
set mark 0 |
| 33 |
set uname 0 |
| 34 |
|
| 35 |
set print 0 |
| 36 |
set main 0 |
| 37 |
set main_func 0 |
| 38 |
set lib_main 0 |
| 39 |
set lib_func 0 |
| 40 |
set start_func 0 |
| 41 |
send_log "Running: stap -w --ldd $srcdir/$subdir/libmarkunamestack.stp $testexe $testlib -c $testexe\n" |
| 42 |
spawn stap -w --ldd $srcdir/$subdir/libmarkunamestack.stp $testexe $testlib -c $testexe |
| 43 |
|
| 44 |
expect { |
| 45 |
-timeout 60 |
| 46 |
-re {^print_[^\r\n]+\r\n} {incr print; exp_continue} |
| 47 |
|
| 48 |
# lib |
| 49 |
-re {^main\r\n} {incr lib; exp_continue} |
| 50 |
-re {^main_func: [1-3]\r\n} {incr lib; exp_continue} |
| 51 |
-re {^lib_main\r\n} {incr lib; exp_continue} |
| 52 |
-re {^lib_func: [1-3]\r\n} {incr lib; exp_continue} |
| 53 |
|
| 54 |
# mark |
| 55 |
-re {^main_count: [1-3]\r\n} {incr mark; exp_continue} |
| 56 |
-re {^func_count: [1-3]\r\n} {incr mark; exp_continue} |
| 57 |
|
| 58 |
# uname |
| 59 |
-re {^exe: main=main\r\n} {incr uname; exp_continue} |
| 60 |
-re {^exe: main_func=main_func\r\n} {incr uname; exp_continue} |
| 61 |
-re {^lib: lib_main=lib_main\r\n} {incr uname; exp_continue} |
| 62 |
-re {^lib: lib_func=lib_func\r\n} {incr uname; exp_continue} |
| 63 |
|
| 64 |
# ustack |
| 65 |
-re {^ 0x[a-f0-9]+ : main\+0x[^\r\n]+\r\n} {incr main; exp_continue} |
| 66 |
-re {^ 0x[a-f0-9]+ : main_func\+0x[^\r\n]+\r\n} {incr main_func; exp_continue} |
| 67 |
-re {^ 0x[a-f0-9]+ : lib_main\+0x[^\r\n]+\r\n} {incr lib_main; exp_continue} |
| 68 |
-re {^ 0x[a-f0-9]+ : lib_func\+0x[^\r\n]+\r\n} {incr lib_func; exp_continue} |
| 69 |
|
| 70 |
# libc/ld/startup |
| 71 |
-re {^ 0x[a-f0-9]+ : _[^\r\n]+\r\n} {incr start_func; exp_continue} |
| 72 |
-re {^ 0x[a-f0-9]+ : [^\r\n]+/libc-[^\r\n]+\r\n} {incr start_func; exp_continue} |
| 73 |
|
| 74 |
timeout { fail "libmarkunamestack-$testname (timeout)"; kill -INT -[exp_pid] } |
| 75 |
eof { } |
| 76 |
} |
| 77 |
# kill again for good measure |
| 78 |
kill -INT -[exp_pid] 2 |
| 79 |
catch {close}; catch {wait -i $spawn_id} |
| 80 |
|
| 81 |
if {$lib == 8} { pass "lib-$testname" } { |
| 82 |
fail "lib-$testname ($lib)" |
| 83 |
} |
| 84 |
|
| 85 |
if {$mark == 6} { pass "mark-$testname" } { |
| 86 |
fail "mark-$testname ($mark)" |
| 87 |
} |
| 88 |
|
| 89 |
if {$uname == 8} { pass "uname-$testname" } { |
| 90 |
fail "uname-$testname ($uname)" |
| 91 |
} |
| 92 |
|
| 93 |
if {$print == 4} { pass "ustack-$testname print" } { |
| 94 |
fail "ustack-$testname print ($print)" |
| 95 |
} |
| 96 |
|
| 97 |
if {$main == 4} { pass "ustack-$testname main" } { |
| 98 |
fail "ustack-$testname main ($main)" |
| 99 |
} |
| 100 |
|
| 101 |
if {$main_func == 9} { pass "ustack-$testname main_func" } { |
| 102 |
fail "ustack-$testname main_func ($main_func)" |
| 103 |
} |
| 104 |
|
| 105 |
if {$lib_main == 2} { pass "ustack-$testname lib_main" } { |
| 106 |
fail "ustack-$testname lib_main ($lib_main)" |
| 107 |
} |
| 108 |
|
| 109 |
if {$lib_func == 3} { pass "ustack-$testname lib_func" } { |
| 110 |
fail "ustack-$testname lib_func ($lib_func)" |
| 111 |
} |