diff options
author | netblue30 <netblue30@yahoo.com> | 2016-04-24 08:45:06 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-04-24 08:45:06 -0400 |
commit | 03443a4b88e3a2cc32b30b1124fde7399c9a138e (patch) | |
tree | d7db9f716b17064f9eac78692d97c2e69b43c3e9 /test | |
parent | compile cleanup (diff) | |
download | firejail-03443a4b88e3a2cc32b30b1124fde7399c9a138e.tar.gz firejail-03443a4b88e3a2cc32b30b1124fde7399c9a138e.tar.zst firejail-03443a4b88e3a2cc32b30b1124fde7399c9a138e.zip |
compile tests
Diffstat (limited to 'test')
-rwxr-xr-x | test/dist-compile/compile.sh | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/test/dist-compile/compile.sh b/test/dist-compile/compile.sh new file mode 100755 index 000000000..a9c1656ee --- /dev/null +++ b/test/dist-compile/compile.sh | |||
@@ -0,0 +1,251 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | arr[1]="TEST 1: standard compilation" | ||
4 | arr[2]="TEST 2: compile seccomp disabled" | ||
5 | arr[3]="TEST 3: compile chroot disabled" | ||
6 | arr[4]="TEST 4: compile bind disabled" | ||
7 | arr[5]="TEST 5: compile user namespace disabled" | ||
8 | arr[6]="TEST 6: compile network disabled" | ||
9 | arr[7]="TEST 7: compile X11 disabled" | ||
10 | arr[8]="TEST 8: compile network restricted" | ||
11 | arr[9]="TEST 9: compile file transfer disabled" | ||
12 | |||
13 | |||
14 | # remove previous reports and output file | ||
15 | cleanup() { | ||
16 | rm -f report* | ||
17 | rm -fr firejail | ||
18 | rm oc* om* | ||
19 | } | ||
20 | |||
21 | print_title() { | ||
22 | echo | ||
23 | echo | ||
24 | echo | ||
25 | echo "**************************************************" | ||
26 | echo $1 | ||
27 | echo "**************************************************" | ||
28 | } | ||
29 | |||
30 | DIST="$1" | ||
31 | while [ $# -gt 0 ]; do # Until you run out of parameters . . . | ||
32 | case "$1" in | ||
33 | --clean) | ||
34 | cleanup | ||
35 | exit | ||
36 | ;; | ||
37 | --help) | ||
38 | echo "./compile.sh [--clean|--help]" | ||
39 | exit | ||
40 | ;; | ||
41 | esac | ||
42 | shift # Check next set of parameters. | ||
43 | done | ||
44 | |||
45 | cleanup | ||
46 | # enable sudo | ||
47 | sudo ls -al | ||
48 | |||
49 | |||
50 | #***************************************************************** | ||
51 | # TEST 1 | ||
52 | #***************************************************************** | ||
53 | # - checkout source code | ||
54 | # - check compilation | ||
55 | # - install | ||
56 | #***************************************************************** | ||
57 | print_title "${arr[1]}" | ||
58 | echo "$DIST" | ||
59 | tar -xjvf ../../$DIST.tar.bz2 | ||
60 | mv $DIST firejail | ||
61 | |||
62 | cd firejail | ||
63 | ./configure --prefix=/usr --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
64 | make -j4 2>&1 | tee ../output-make | ||
65 | sudo make install 2>&1 | tee ../output-install | ||
66 | cd .. | ||
67 | grep Warning output-configure output-make output-install > ./report-test1 | ||
68 | grep Error output-configure output-make output-install >> ./report-test1 | ||
69 | cp output-configure oc1 | ||
70 | cp output-make om1 | ||
71 | rm output-configure output-make output-install | ||
72 | |||
73 | |||
74 | #***************************************************************** | ||
75 | # TEST 2 | ||
76 | #***************************************************************** | ||
77 | # - disable seccomp configuration | ||
78 | # - check compilation | ||
79 | #***************************************************************** | ||
80 | print_title "${arr[2]}" | ||
81 | # seccomp | ||
82 | cd firejail | ||
83 | make distclean | ||
84 | ./configure --prefix=/usr --disable-seccomp --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
85 | make -j4 2>&1 | tee ../output-make | ||
86 | cd .. | ||
87 | grep Warning output-configure output-make > ./report-test2 | ||
88 | grep Error output-configure output-make >> ./report-test2 | ||
89 | cp output-configure oc2 | ||
90 | cp output-make om2 | ||
91 | rm output-configure output-make | ||
92 | |||
93 | #***************************************************************** | ||
94 | # TEST 3 | ||
95 | #***************************************************************** | ||
96 | # - disable chroot configuration | ||
97 | # - check compilation | ||
98 | #***************************************************************** | ||
99 | print_title "${arr[3]}" | ||
100 | # seccomp | ||
101 | cd firejail | ||
102 | make distclean | ||
103 | ./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
104 | make -j4 2>&1 | tee ../output-make | ||
105 | cd .. | ||
106 | grep Warning output-configure output-make > ./report-test3 | ||
107 | grep Error output-configure output-make >> ./report-test3 | ||
108 | cp output-configure oc3 | ||
109 | cp output-make om3 | ||
110 | rm output-configure output-make | ||
111 | |||
112 | #***************************************************************** | ||
113 | # TEST 4 | ||
114 | #***************************************************************** | ||
115 | # - disable bind configuration | ||
116 | # - check compilation | ||
117 | #***************************************************************** | ||
118 | print_title "${arr[4]}" | ||
119 | # seccomp | ||
120 | cd firejail | ||
121 | make distclean | ||
122 | ./configure --prefix=/usr --disable-bind --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
123 | make -j4 2>&1 | tee ../output-make | ||
124 | cd .. | ||
125 | grep Warning output-configure output-make > ./report-test4 | ||
126 | grep Error output-configure output-make >> ./report-test4 | ||
127 | cp output-configure oc4 | ||
128 | cp output-make om4 | ||
129 | rm output-configure output-make | ||
130 | |||
131 | #***************************************************************** | ||
132 | # TEST 5 | ||
133 | #***************************************************************** | ||
134 | # - disable user namespace configuration | ||
135 | # - check compilation | ||
136 | #***************************************************************** | ||
137 | print_title "${arr[5]}" | ||
138 | # seccomp | ||
139 | cd firejail | ||
140 | make distclean | ||
141 | ./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
142 | make -j4 2>&1 | tee ../output-make | ||
143 | cd .. | ||
144 | grep Warning output-configure output-make > ./report-test5 | ||
145 | grep Error output-configure output-make >> ./report-test5 | ||
146 | cp output-configure oc5 | ||
147 | cp output-make om5 | ||
148 | rm output-configure output-make | ||
149 | |||
150 | #***************************************************************** | ||
151 | # TEST 6 | ||
152 | #***************************************************************** | ||
153 | # - disable user namespace configuration | ||
154 | # - check compilation | ||
155 | #***************************************************************** | ||
156 | print_title "${arr[6]}" | ||
157 | # seccomp | ||
158 | cd firejail | ||
159 | make distclean | ||
160 | ./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
161 | make -j4 2>&1 | tee ../output-make | ||
162 | cd .. | ||
163 | grep Warning output-configure output-make > ./report-test6 | ||
164 | grep Error output-configure output-make >> ./report-test6 | ||
165 | cp output-configure oc6 | ||
166 | cp output-make om6 | ||
167 | rm output-configure output-make | ||
168 | |||
169 | #***************************************************************** | ||
170 | # TEST 7 | ||
171 | #***************************************************************** | ||
172 | # - disable X11 support | ||
173 | # - check compilation | ||
174 | #***************************************************************** | ||
175 | print_title "${arr[7]}" | ||
176 | # seccomp | ||
177 | cd firejail | ||
178 | make distclean | ||
179 | ./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
180 | make -j4 2>&1 | tee ../output-make | ||
181 | cd .. | ||
182 | grep Warning output-configure output-make > ./report-test7 | ||
183 | grep Error output-configure output-make >> ./report-test7 | ||
184 | cp output-configure oc7 | ||
185 | cp output-make om7 | ||
186 | rm output-configure output-make | ||
187 | |||
188 | |||
189 | #***************************************************************** | ||
190 | # TEST 8 | ||
191 | #***************************************************************** | ||
192 | # - enable network restricted | ||
193 | # - check compilation | ||
194 | #***************************************************************** | ||
195 | print_title "${arr[8]}" | ||
196 | # seccomp | ||
197 | cd firejail | ||
198 | make distclean | ||
199 | ./configure --prefix=/usr --enable-network=restricted --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
200 | make -j4 2>&1 | tee ../output-make | ||
201 | cd .. | ||
202 | grep Warning output-configure output-make > ./report-test8 | ||
203 | grep Error output-configure output-make >> ./report-test8 | ||
204 | cp output-configure oc8 | ||
205 | cp output-make om8 | ||
206 | rm output-configure output-make | ||
207 | |||
208 | |||
209 | #***************************************************************** | ||
210 | # TEST 9 | ||
211 | #***************************************************************** | ||
212 | # - disable file transfer | ||
213 | # - check compilation | ||
214 | #***************************************************************** | ||
215 | print_title "${arr[9]}" | ||
216 | # seccomp | ||
217 | cd firejail | ||
218 | make distclean | ||
219 | ./configure --prefix=/usr --enable-network=restricted --enable-fatal-warnings 2>&1 | tee ../output-configure | ||
220 | make -j4 2>&1 | tee ../output-make | ||
221 | cd .. | ||
222 | grep Warning output-configure output-make > ./report-test9 | ||
223 | grep Error output-configure output-make >> ./report-test9 | ||
224 | cp output-configure oc9 | ||
225 | cp output-make om9 | ||
226 | rm output-configure output-make | ||
227 | |||
228 | |||
229 | #***************************************************************** | ||
230 | # PRINT REPORTS | ||
231 | #***************************************************************** | ||
232 | echo | ||
233 | echo | ||
234 | echo | ||
235 | echo | ||
236 | echo "**********************************************************" | ||
237 | echo "TEST RESULTS" | ||
238 | echo "**********************************************************" | ||
239 | |||
240 | wc -l report-test* | ||
241 | echo | ||
242 | echo "Legend:" | ||
243 | echo ${arr[1]} | ||
244 | echo ${arr[2]} | ||
245 | echo ${arr[3]} | ||
246 | echo ${arr[4]} | ||
247 | echo ${arr[5]} | ||
248 | echo ${arr[6]} | ||
249 | echo ${arr[7]} | ||
250 | echo ${arr[8]} | ||
251 | echo ${arr[9]} | ||