| 1 |
set test "Invalid Unprivileged Mode Arguments" |
| 2 |
|
| 3 |
# Test that stap on the server side will correctly accept/reject certain |
| 4 |
# arguments in unprivileged mode. |
| 5 |
|
| 6 |
# Test invalid combinations. |
| 7 |
# Other invalid options are invalid only when used with the compile-server |
| 8 |
# client and are tested in systemtap.server/client_args.exp. |
| 9 |
set invalid_options [list \ |
| 10 |
"--unprivileged -g" \ |
| 11 |
"-g --unprivileged" \ |
| 12 |
] |
| 13 |
|
| 14 |
foreach options $invalid_options { |
| 15 |
set error_regexp ".*You can't specify .* and --privilege=stapusr together.*" |
| 16 |
verbose -log "eval exec stap $options" |
| 17 |
catch {eval exec stap -e {probe begin { exit() }} -p1 $options} res_stap |
| 18 |
verbose -log $res_stap |
| 19 |
if {[regexp $error_regexp $res_stap]} { |
| 20 |
pass "$test: $options" |
| 21 |
} else { |
| 22 |
fail "$test: $options" |
| 23 |
} |
| 24 |
|
| 25 |
# We should get the same result substituting --unprivileged with --privilege=stapusr |
| 26 |
if {[regsub -all {\-\-unprivileged} $options "--privilege=stapusr" options]} { |
| 27 |
verbose -log "eval exec stap $options" |
| 28 |
catch {eval exec stap -e {probe begin { exit() }} -p1 $options} res_stap |
| 29 |
verbose -log $res_stap |
| 30 |
if {[regexp $error_regexp $res_stap]} { |
| 31 |
pass "$test: $options" |
| 32 |
} else { |
| 33 |
fail "$test: $options" |
| 34 |
} |
| 35 |
# We should get the same result substituting --privilege=stapusr with --privilege=stapsys |
| 36 |
if {[regsub -all {\-\-privilege=stapusr} $options "--privilege=stapsys" options]} { |
| 37 |
set error_regexp ".*You can't specify .* and --privilege=stapsys together.*" |
| 38 |
verbose -log "eval exec stap $options" |
| 39 |
catch {eval exec stap -e {probe begin { exit() }} -p1 $options} res_stap |
| 40 |
verbose -log $res_stap |
| 41 |
if {[regexp $error_regexp $res_stap]} { |
| 42 |
pass "$test: $options" |
| 43 |
} else { |
| 44 |
fail "$test: $options" |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
} |