| 1 |
# test end probe creation and display of written and unread global variables |
| 2 |
|
| 3 |
set test "global_end" |
| 4 |
|
| 5 |
if {![installtest_p]} {untested $test; return} |
| 6 |
|
| 7 |
foreach private {0 1} { |
| 8 |
foreach runtime [get_runtime_list] { |
| 9 |
set test "global_end" |
| 10 |
|
| 11 |
if {$runtime != ""} { |
| 12 |
set test "${test}_${runtime}" |
| 13 |
spawn sh -c "stap $srcdir/$subdir/global_end.stp $private --runtime=$runtime | sort" |
| 14 |
} else { |
| 15 |
spawn sh -c "stap $srcdir/$subdir/global_end.stp $private | sort" |
| 16 |
} |
| 17 |
set ok 0 |
| 18 |
|
| 19 |
set ok 0 |
| 20 |
expect { |
| 21 |
-timeout 180 |
| 22 |
-re {^alpha."two".2.=4\r\n} { incr ok; exp_continue } |
| 23 |
-re {^alpha."two".1.=3\r\n} { incr ok; exp_continue } |
| 24 |
-re {^alpha."one".2.=2\r\n} { incr ok; exp_continue } |
| 25 |
-re {^alpha."one".1.=1\r\n} { incr ok; exp_continue } |
| 26 |
-re {^epsilon."one", 1. count:4 min:1 max:4 sum:10 avg:2\r\n} { |
| 27 |
incr ok; exp_continue } |
| 28 |
-re {^epsilon."two", 2. count:4 min:10 max:40 sum:100 avg:25\r\n} { |
| 29 |
incr ok; exp_continue } |
| 30 |
-re {^gamma="abcdefghijklmnopqrstuvwxyz"\r\n} { incr ok; exp_continue } |
| 31 |
-re {^iota."two".="twelve"\r\n} { incr ok; exp_continue } |
| 32 |
-re {^iota."one".="eleven"\r\n} { incr ok; exp_continue } |
| 33 |
-re {^.one,0x1.=0x1 .one,0x2.=0x2 .two,0x1.=0x3 .two,0x2.=0x4 \r\n} { incr ok; exp_continue } |
| 34 |
-re {^phi @count=4 @min=1 @max=4 @sum=10 @avg=2\r\n} { |
| 35 |
incr ok; exp_continue } |
| 36 |
timeout { fail "$test (timeout)" } |
| 37 |
eof { } |
| 38 |
} |
| 39 |
catch {close}; catch {wait} |
| 40 |
|
| 41 |
if {$runtime != ""} { |
| 42 |
spawn stap $srcdir/$subdir/global_end2.stp --runtime=$runtime |
| 43 |
} else { |
| 44 |
spawn stap $srcdir/$subdir/global_end2.stp |
| 45 |
} |
| 46 |
# above should not do any tapset global variable display so |
| 47 |
# ok should only change by 1 |
| 48 |
expect { |
| 49 |
-timeout 180 |
| 50 |
-re {Avg time = [0-9]} { incr ok; exp_continue } |
| 51 |
} |
| 52 |
catch {close}; catch {wait} |
| 53 |
|
| 54 |
if {$ok == 12} { pass "$test ($ok)" } { fail "$test ($ok)" } |
| 55 |
|
| 56 |
# test PR6954 |
| 57 |
set test "global_end_var" |
| 58 |
if {$runtime != ""} { |
| 59 |
set test "${test}_${runtime}" |
| 60 |
spawn stap $srcdir/$subdir/global_end_var.stp $private --runtime=$runtime |
| 61 |
} else { |
| 62 |
spawn stap $srcdir/$subdir/global_end_var.stp $private |
| 63 |
} |
| 64 |
set ok 0 |
| 65 |
expect { |
| 66 |
-timeout 180 |
| 67 |
-re {gs0_save=41} { incr ok; exp_continue } |
| 68 |
-re {gs2=4} { incr ok; exp_continue } |
| 69 |
-re {gs3=4} { incr ok; exp_continue } |
| 70 |
-re {gs4=5} { incr ok; exp_continue } |
| 71 |
-re {ga1."foo".=2} { incr ok; exp_continue } |
| 72 |
-re {ga2."foo".=1} { incr ok; exp_continue } |
| 73 |
timeout { fail "$test (timeout)" } |
| 74 |
eof { } |
| 75 |
} |
| 76 |
catch {close}; catch {wait} |
| 77 |
|
| 78 |
if {$ok == 6} { pass "$test ($ok)" } { fail "$test ($ok)" } |
| 79 |
|
| 80 |
# test PR17749 |
| 81 |
set test "global_end_var_used" |
| 82 |
if {$runtime != ""} { |
| 83 |
set test "${test}_${runtime}" |
| 84 |
spawn stap $srcdir/$subdir/global_end_var_used.stp $private --runtime=$runtime |
| 85 |
} else { |
| 86 |
spawn stap $srcdir/$subdir/global_end_var_used.stp $private |
| 87 |
} |
| 88 |
set ok 0 |
| 89 |
# strictly look for "hello". if anything else is printed it's a fail. |
| 90 |
expect { |
| 91 |
-timeout 180 |
| 92 |
-re {^hello!$} { incr ok; exp_continue } |
| 93 |
timeout { fail "$test (timeout)" } |
| 94 |
eof { } |
| 95 |
} |
| 96 |
catch {close}; catch {wait} |
| 97 |
|
| 98 |
if {$ok == 1} { pass "$test ($ok)" } { fail "$test ($ok)" } |
| 99 |
} |
| 100 |
} |