summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.server/client_args.exp
blob: f41b91cb5c6f7cf484ec553637062e5b8d8ca531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
set test "Invalid Server Client Arguments"

# Test that stap on the server side will correctly accept/reject certain
# arguments in unprivileged mode.
set test_file $srcdir/systemtap.server/test.stp

# Test invalid combinations.
set error_regexp ".*You can't specify .* 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 $test_file -p1 $options} res_stap
    verbose -log $res_stap

    if {[regexp $error_regexp $res_stap]} {
	pass "$test: $options"
    } else {
	fail "$test: $options"
    }
}

# Test valid combinations
# stap_run_exact (used below) only works for 'make installcheck'
if {[info procs installtest_p] != "" && ![installtest_p]} { untested $test; return }

set test "Valid Server Client Arguments"

set no_error_result "# parse tree dump
# file $test_file
probe begin{
exit()
}

"

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" \
  "--client-options --unprivileged" \
  "--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 --client-options" \
  "-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 --unprivileged" \
]

set ::result_string "$no_error_result"
foreach options $valid_options {
    eval stap_run_exact {"$test: $options"} $test_file -p1 $options
}