| 1 |
set test "wordexp" |
| 2 |
|
| 3 |
# Only run on make installcheck |
| 4 |
if {! [installtest_p]} { untested "$test"; return } |
| 5 |
|
| 6 |
# Makes sure SystemTap gracefully handles various -c failures. |
| 7 |
|
| 8 |
proc expect_semerror { command experror } { |
| 9 |
global test |
| 10 |
set subtest "$test -c \"$command\"" |
| 11 |
|
| 12 |
set script "probe process.function(\"foo\") { next }" |
| 13 |
if {[string length $command]} { |
| 14 |
eval spawn stap -e {$script} -c {$command} |
| 15 |
} else { |
| 16 |
eval spawn stap -e {$script} |
| 17 |
} |
| 18 |
|
| 19 |
set failed 1 |
| 20 |
expect { |
| 21 |
-timeout 20 |
| 22 |
-re "$experror" { |
| 23 |
set failed 0 |
| 24 |
} |
| 25 |
eof { |
| 26 |
fail "$subtest (eof)" |
| 27 |
} |
| 28 |
timeout { |
| 29 |
kill -INT -[exp_pid] 2 |
| 30 |
fail "$subtest (timeout)" |
| 31 |
} |
| 32 |
} |
| 33 |
catch {close}; catch {wait} |
| 34 |
if {!$failed} { |
| 35 |
pass "$subtest" |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
expect_semerror "" \ |
| 40 |
"semantic error: unspecified process probe is invalid without a -c COMMAND" |
| 41 |
expect_semerror "ls || true" \ |
| 42 |
"semantic error: invalid -c command .* illegal characters" |
| 43 |
expect_semerror "ls \$HOPEFULLYTHISISNTACTUALLYDEFINED" \ |
| 44 |
"semantic error: invalid -c command .* undefined shell variables" |
| 45 |
expect_semerror "ls `out`" \ |
| 46 |
"semantic error: invalid -c command .* contains command substitutions" |
| 47 |
expect_semerror "ls \"string" \ |
| 48 |
"semantic error: invalid -c command .* contains shell syntax errors" |