| 1 |
set test "at_var_unresolved" |
| 2 |
|
| 3 |
# Ensure that there is only one error message for an unresolved @var. |
| 4 |
|
| 5 |
# Only run on make installcheck |
| 6 |
if {! [installtest_p]} { untested "$test"; return } |
| 7 |
|
| 8 |
# Case 1: Test @var("name"): |
| 9 |
|
| 10 |
spawn stap -e "probe begin { println(@var(\"var_really_not_exist\")) exit() }" |
| 11 |
set errs 0 |
| 12 |
|
| 13 |
expect { |
| 14 |
-timeout 180 |
| 15 |
|
| 16 |
-re {^semantic error: unresolved \@var\(\) expression: operator \'\@var\' at} { |
| 17 |
incr errs; exp_continue |
| 18 |
} |
| 19 |
|
| 20 |
-re {^sematnic error: } { |
| 21 |
incr errs; exp_continue |
| 22 |
} |
| 23 |
|
| 24 |
-re {^[^\r\n]*\r\n} { exp_continue } |
| 25 |
|
| 26 |
timeout { fail "$test (timeout)" } |
| 27 |
eof { } |
| 28 |
} |
| 29 |
catch { close }; catch { wait } |
| 30 |
|
| 31 |
if {$errs == 1} { |
| 32 |
pass "$test ($errs)" |
| 33 |
} { |
| 34 |
fail "$test ($errs)" |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
# Case 2: Test @var("name@cuname"): |
| 39 |
|
| 40 |
set errs 0 |
| 41 |
|
| 42 |
spawn stap -e "probe begin { println(@var(\"var_really_not_exist@*.c\")) exit() }" |
| 43 |
set ok 0 |
| 44 |
|
| 45 |
expect { |
| 46 |
-timeout 180 |
| 47 |
|
| 48 |
-re {^semantic error: unresolved \@var\(\) expression: operator \'\@var\' at} { |
| 49 |
incr ok; exp_continue |
| 50 |
} |
| 51 |
|
| 52 |
-re {^sematnic error: } { |
| 53 |
incr errs; exp_continue |
| 54 |
} |
| 55 |
|
| 56 |
-re {^[^\r\n]*\r\n} { exp_continue } |
| 57 |
|
| 58 |
timeout { fail "$test (timeout)" } |
| 59 |
eof { } |
| 60 |
} |
| 61 |
catch { close }; catch { wait } |
| 62 |
|
| 63 |
if {$ok == 1 && $errs == 0} { |
| 64 |
pass "$test (cuname: $ok, $errs)" |
| 65 |
} { |
| 66 |
fail "$test (cuname: $ok, $errs)" |
| 67 |
} |