| 1 |
set test "abort" |
| 2 |
set testpath "$srcdir/$subdir" |
| 3 |
|
| 4 |
if {! [installtest_p]} { untested "$test"; return } |
| 5 |
|
| 6 |
# --- TEST 1 --- |
| 7 |
|
| 8 |
set subtest1 "TEST 1: abort() in the middle of a func body" |
| 9 |
foreach runtime [get_runtime_list] { |
| 10 |
if {$runtime eq ""} { |
| 11 |
set runtime "kernel" |
| 12 |
} |
| 13 |
set test_name "$test: $subtest1 ($runtime)" |
| 14 |
|
| 15 |
set exit_code [run_cmd_2way "stap --runtime=$runtime '$srcdir/$subdir/${test}_1.stp'" out stderr] |
| 16 |
|
| 17 |
set exp_out "enter f |
| 18 |
" |
| 19 |
is "${test_name}: stdout" $out $exp_out |
| 20 |
|
| 21 |
is "${test_name}: exit code" $exit_code 0 |
| 22 |
if {$stderr ne ""} { |
| 23 |
send_log "stderr:\n$stderr" |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
# --- TEST 2 --- |
| 28 |
|
| 29 |
set subtest2 "TEST 2: abort() in the middle of a func body in a deeper func call chain" |
| 30 |
foreach runtime [get_runtime_list] { |
| 31 |
if {$runtime eq ""} { |
| 32 |
set runtime "kernel" |
| 33 |
} |
| 34 |
set test_name "$test: $subtest2 ($runtime)" |
| 35 |
|
| 36 |
set exit_code [run_cmd_2way "stap --runtime=$runtime '$srcdir/$subdir/${test}_2.stp'" out stderr] |
| 37 |
|
| 38 |
set exp_out "enter g |
| 39 |
enter f |
| 40 |
" |
| 41 |
is "${test_name}: stdout" $out $exp_out |
| 42 |
|
| 43 |
is "${test_name}: exit code" $exit_code 0 |
| 44 |
if {$stderr ne ""} { |
| 45 |
send_log "stderr:\n$stderr" |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
# --- TEST 3 --- |
| 50 |
|
| 51 |
set subtest3 "TEST 3: abort() in the middle of a probe handler body" |
| 52 |
foreach runtime [get_runtime_list] { |
| 53 |
if {$runtime eq ""} { |
| 54 |
set runtime "kernel" |
| 55 |
} |
| 56 |
set test_name "$test: $subtest3 ($runtime)" |
| 57 |
|
| 58 |
set exit_code [run_cmd_2way "stap --runtime=$runtime '$srcdir/$subdir/${test}_3.stp'" out stderr] |
| 59 |
|
| 60 |
set exp_out "enter probe |
| 61 |
" |
| 62 |
is "${test_name}: stdout" $out $exp_out |
| 63 |
|
| 64 |
is "${test_name}: exit code" $exit_code 0 |
| 65 |
if {$stderr ne ""} { |
| 66 |
send_log "stderr:\n$stderr" |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
# --- TEST 4 --- |
| 71 |
|
| 72 |
set subtest4 "TEST 4: abort() in the middle of a probe handler body (--compatible 4.0)" |
| 73 |
foreach runtime [get_runtime_list] { |
| 74 |
if {$runtime eq ""} { |
| 75 |
set runtime "kernel" |
| 76 |
} |
| 77 |
set test_name "$test: $subtest4 ($runtime)" |
| 78 |
|
| 79 |
set exit_code [run_cmd_2way "stap --compatible 4.0 --runtime=$runtime '$srcdir/$subdir/${test}_3.stp'" out stderr] |
| 80 |
|
| 81 |
set exp_out "enter probe |
| 82 |
" |
| 83 |
is "${test_name}: stdout" $out $exp_out |
| 84 |
|
| 85 |
is "${test_name}: exit code" $exit_code 0 |
| 86 |
if {$stderr ne ""} { |
| 87 |
send_log "stderr:\n$stderr" |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
# --- TEST 5 --- |
| 92 |
|
| 93 |
set subtest5 "TEST 5: abort() in the middle of a probe handler body (--compatible 3.3)" |
| 94 |
set test_name "$test: $subtest5" |
| 95 |
|
| 96 |
set exit_code [run_cmd_2way "stap --compatible 3.3 '$srcdir/$subdir/${test}_3.stp'" out stderr] |
| 97 |
|
| 98 |
set exp_out "" |
| 99 |
is "${test_name}: stdout" $out $exp_out |
| 100 |
isnt "${test_name}: exit code" $exit_code 0 |
| 101 |
|
| 102 |
set stderr_pat "^semantic error: unresolved function.*\\(similar: \[^\\n\]*?\\): identifier 'abort' at \[^\\n\]*?\\.stp:3:5\\n" |
| 103 |
like "${test_name}: stderr" $stderr $stderr_pat "-linestop -lineanchor" |
| 104 |
|
| 105 |
# --- TEST 6 --- |
| 106 |
|
| 107 |
set subtest6 "TEST 6: abort() in timer.profile (using globals)" |
| 108 |
set test_name "$test: $subtest6" |
| 109 |
|
| 110 |
set exit_code [run_cmd_2way "stap '$srcdir/$subdir/${test}_6.stp'" out stderr] |
| 111 |
|
| 112 |
set exp_out "fire 3! |
| 113 |
fire 2! |
| 114 |
fire 1! |
| 115 |
" |
| 116 |
is "${test_name}: stdout" $out $exp_out |
| 117 |
|
| 118 |
is "${test_name}: exit code" $exit_code 0 |
| 119 |
if {$stderr ne ""} { |
| 120 |
send_log "stderr:\n$stderr" |
| 121 |
} |
| 122 |
|
| 123 |
# --- TEST 7 --- |
| 124 |
|
| 125 |
set subtest7 "TEST 7: abort() in timer.profile (more concurrency and no globals)" |
| 126 |
set test_name "$test: $subtest7" |
| 127 |
|
| 128 |
set exit_code [run_cmd_2way "stap '$srcdir/$subdir/${test}_7.stp'" out stderr] |
| 129 |
|
| 130 |
set exp_out "" |
| 131 |
is "${test_name}: stdout" $out $exp_out |
| 132 |
|
| 133 |
set exp_stderr "" |
| 134 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 135 |
|
| 136 |
is "${test_name}: exit code" $exit_code 0 |
| 137 |
|
| 138 |
# --- TEST 8 --- |
| 139 |
|
| 140 |
set subtest8 "TEST 8: abort() in the middle of a func body - abort() cannot be caught" |
| 141 |
foreach runtime [get_runtime_list] { |
| 142 |
if {$runtime eq ""} { |
| 143 |
set runtime "kernel" |
| 144 |
} |
| 145 |
set test_name "$test: $subtest8 ($runtime)" |
| 146 |
|
| 147 |
set exit_code [run_cmd_2way "stap --runtime=$runtime '$srcdir/$subdir/${test}_8.stp'" out stderr] |
| 148 |
|
| 149 |
set exp_out "enter f |
| 150 |
" |
| 151 |
is "${test_name}: stdout" $out $exp_out |
| 152 |
|
| 153 |
is "${test_name}: exit code" $exit_code 0 |
| 154 |
if {$stderr ne ""} { |
| 155 |
send_log "stderr:\n$stderr" |
| 156 |
} |
| 157 |
} |