diff options
author | Dave Brolley <brolley@redhat.com> | 2010-01-11 20:13:40 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2010-01-11 20:13:40 -0500 |
commit | a0ace4915e5d963c28fa3b54f87afef34b82b6a5 (patch) | |
tree | 8498bb2c48473f92334e29eb7dcf7f9460b8ad8b /testsuite | |
parent | 44f348171ea72bf8a195fd281a3226541468b65c (diff) | |
download | systemtap-steved-a0ace4915e5d963c28fa3b54f87afef34b82b6a5.tar.gz systemtap-steved-a0ace4915e5d963c28fa3b54f87afef34b82b6a5.tar.xz systemtap-steved-a0ace4915e5d963c28fa3b54f87afef34b82b6a5.zip |
Rework filtering of client options. Add testsuite.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.server/client_args.exp | 102 | ||||
-rw-r--r-- | testsuite/systemtap.server/test.stp | 1 |
2 files changed, 103 insertions, 0 deletions
diff --git a/testsuite/systemtap.server/client_args.exp b/testsuite/systemtap.server/client_args.exp new file mode 100644 index 00000000..35d418ee --- /dev/null +++ b/testsuite/systemtap.server/client_args.exp @@ -0,0 +1,102 @@ +set test "Server Client Arguments" + +# stap_run_exact only works for 'make installcheck' +if {[info procs installtest_p] != "" && ![installtest_p]} { untested $test; return } + +# Test that stap on the server side will correctly accept/reject certain +# arguments in unprivileged mode. +set test_file $srcdir/systemtap.server/test.stp + +set no_error_result "# parse tree dump +# file $test_file +probe begin{ +exit() +} + +" + +# First test valid combinations +set valid_options [list \ + "-a i386" \ + "-B X=Y" \ + "-D X=Y" \ + "-I /tmp" \ + "-m test" \ + "-R /tmp" \ + "-r [exec uname -r]" \ + "-a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--unprivileged" \ + "--unprivileged -a i386" \ + "--unprivileged -B X=Y" \ + "--unprivileged -D X=Y" \ + "--unprivileged -I /tmp" \ + "--unprivileged -m test" \ + "--unprivileged -R /tmp" \ + "--unprivileged -r [exec uname -r]" \ + "--unprivileged -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--client-options" \ + "--client-options -a i386" \ + "--client-options -B X=Y" \ + "--client-options -D X=Y" \ + "--client-options -I /tmp" \ + "--client-options -m test" \ + "--client-options -R /tmp" \ + "--client-options -r [exec uname -r]" \ + "--client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--unprivileged --client-options" \ + "--unprivileged -a i386 --client-options" \ + "--unprivileged -B X=Y --client-options" \ + "--unprivileged -D X=Y --client-options" \ + "--unprivileged -I /tmp --client-options" \ + "--unprivileged -m test --client-options" \ + "--unprivileged -R /tmp --client-options" \ + "--unprivileged -r [exec uname -r] --client-options" \ + "--unprivileged -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r] --client-options" \ +] + +set ::result_string "$no_error_result" +foreach options $valid_options { + eval stap_run_exact {"$test: $options"} $test_file -p1 $options +} + +# Now test invalid combinations. +set error_regexp ".*You can't specify (-\[aBDImRr\], )*-\[aBDImRr\] when --unprivileged is specified.*" + +set invalid_options [list \ + "--unprivileged --client-options -a i386" \ + "--unprivileged --client-options -B X=Y" \ + "--unprivileged --client-options -D X=Y" \ + "--unprivileged --client-options -I /tmp" \ + "--unprivileged --client-options -m test" \ + "--unprivileged --client-options -R /tmp" \ + "--unprivileged --client-options -r [exec uname -r]" \ + "--unprivileged --client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--client-options --unprivileged -a i386" \ + "--client-options --unprivileged -B X=Y" \ + "--client-options --unprivileged -D X=Y" \ + "--client-options --unprivileged -I /tmp" \ + "--client-options --unprivileged -m test" \ + "--client-options --unprivileged -R /tmp" \ + "--client-options --unprivileged -r [exec uname -r]" \ + "--client-options --unprivileged -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--client-options -a i386 --unprivileged" \ + "--client-options -B X=Y --unprivileged" \ + "--client-options -D X=Y --unprivileged" \ + "--client-options -I /tmp --unprivileged" \ + "--client-options -m test --unprivileged" \ + "--client-options -R /tmp --unprivileged" \ + "--client-options -r [exec uname -r] --unprivileged" \ + "--client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r] --unprivileged" \ +] + +foreach options $invalid_options { + verbose -log "eval exec stap $options" + catch {eval exec stap -p1 $options} res_stap + verbose -log $res_stap + + if {[regexp $error_regexp $res_stap]} { + pass "$test: $options" + } else { + fail "$test: $options" + } +} diff --git a/testsuite/systemtap.server/test.stp b/testsuite/systemtap.server/test.stp new file mode 100644 index 00000000..e0f4117f --- /dev/null +++ b/testsuite/systemtap.server/test.stp @@ -0,0 +1 @@ +probe begin { exit (); } |