| 1 |
set test "stable_function" |
| 2 |
set testpath "$srcdir/$subdir" |
| 3 |
|
| 4 |
if {![installtest_p]} {untested $test; return} |
| 5 |
|
| 6 |
# check output is same after optimization |
| 7 |
proc run_test {test exp hits} { |
| 8 |
global testpath |
| 9 |
set success 0 |
| 10 |
eval spawn stap -g $testpath/$test.stp |
| 11 |
expect { |
| 12 |
-timeout 30 |
| 13 |
-re "^$exp $hits\r\n$" { |
| 14 |
if { $success == 0 } { |
| 15 |
verbose -log "match with optimized version\n" |
| 16 |
set success 1 |
| 17 |
} |
| 18 |
} |
| 19 |
} |
| 20 |
catch { close }; catch { wait } |
| 21 |
|
| 22 |
eval spawn stap -u -g $testpath/$test.stp |
| 23 |
expect { |
| 24 |
-timeout 30 |
| 25 |
-re "^$exp" { |
| 26 |
if { $success == 1 } { |
| 27 |
verbose -log "match with unoptimized version\n" |
| 28 |
set success 2 |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
catch { close }; catch { wait } |
| 33 |
|
| 34 |
if { $success == 2 } { pass $test } { fail $test } |
| 35 |
} |
| 36 |
|
| 37 |
run_test stable_function_single "100" "1" |
| 38 |
run_test stable_function_multi "400 400" "1" |
| 39 |
run_test stable_function_mix "300 300 100" "3 2" |
| 40 |
run_test stable_function_loop "18000" "1" |
| 41 |
run_test stable_function_branch "102 101 100 101" "1 2 1" |