aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/extract_command.exp16
-rwxr-xr-xtest/invalid_filename.exp236
-rwxr-xr-xtest/private.exp2
-rwxr-xr-xtest/profile_apps.exp48
-rwxr-xr-xtest/test.sh6
5 files changed, 250 insertions, 58 deletions
diff --git a/test/extract_command.exp b/test/extract_command.exp
index c49614b84..b4a1eeeb5 100755
--- a/test/extract_command.exp
+++ b/test/extract_command.exp
@@ -4,20 +4,24 @@ set timeout 10
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "firejail --debug /usr/bin/firefox www.gentoo.org\r" 7send -- "firejail --debug ls -al\r"
8expect { 8expect {
9 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Reading profile /etc/firejail/firefox.profile" 10 "Reading profile /etc/firejail/generic.profile"
11} 11}
12expect { 12expect {
13 timeout {puts "TESTING ERROR 1\n";exit} 13 timeout {puts "TESTING ERROR 1\n";exit}
14 "Starting /usr/bin/firefox" 14 "Starting ls -al"
15} 15}
16expect { 16expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 17 timeout {puts "TESTING ERROR 2\n";exit}
18 "Child process initialized" 18 "Child process initialized"
19} 19}
20sleep 5 20expect {
21 timeout {puts "TESTING ERROR 2\n";exit}
22 "parent is shutting down, bye"
23}
24sleep 1
21 25
22puts "\n" 26puts "\nall done\n"
23 27
diff --git a/test/invalid_filename.exp b/test/invalid_filename.exp
new file mode 100755
index 000000000..ca35262f8
--- /dev/null
+++ b/test/invalid_filename.exp
@@ -0,0 +1,236 @@
1#!/usr/bin/expect -f
2
3#invalid_filename checks:
4#
5#--bind (two files) - profile.c - Note: The test is not implemented here, need to be root to test it
6#--blacklist - profile.c
7#--cgroup - cgroup.c
8#--chroot - main.c
9#--netfilter - netfilter.c
10#--output - output.c
11#--private - fs_home.c
12#--privte-bin (list) - fs_bin.c
13#--private-keep/--private-home (list) - fs_home.c
14#--private-etc (list) - fs_etc.c
15#--profile - main.c
16#--read_only - profile.c
17#--shell - main.c
18#--tmpfs - profile.c
19#--white-list
20
21
22set timeout 10
23spawn $env(SHELL)
24match_max 100000
25
26send -- "firejail --debug --noprofile --blacklist=\"bla&&bla\"\r"
27expect {
28 timeout {puts "TESTING ERROR 1.1\n";exit}
29 "Checking filename bla&&bla"
30}
31expect {
32 timeout {puts "TESTING ERROR 1.2\n";exit}
33 "Error:"
34}
35expect {
36 timeout {puts "TESTING ERROR 1.3\n";exit}
37 "is an invalid filename"
38}
39after 100
40
41send -- "firejail --debug --noprofile --cgroup=\"bla&&bla\"\r"
42expect {
43 timeout {puts "TESTING ERROR 2.1\n";exit}
44 "Checking filename bla&&bla"
45}
46expect {
47 timeout {puts "TESTING ERROR 2.2\n";exit}
48 "Error:"
49}
50expect {
51 timeout {puts "TESTING ERROR 2.3\n";exit}
52 "is an invalid filename"
53}
54after 100
55
56send -- "firejail --debug --noprofile --chroot=\"bla&&bla\"\r"
57expect {
58 timeout {puts "TESTING ERROR 3.1\n";exit}
59 "Checking filename bla&&bla"
60}
61expect {
62 timeout {puts "TESTING ERROR 3.2\n";exit}
63 "Error:"
64}
65expect {
66 timeout {puts "TESTING ERROR 3.3\n";exit}
67 "is an invalid filename"
68}
69after 100
70
71send -- "firejail --debug --noprofile --netfilter=\"bla&&bla\"\r"
72expect {
73 timeout {puts "TESTING ERROR 4.1\n";exit}
74 "Checking filename bla&&bla"
75}
76expect {
77 timeout {puts "TESTING ERROR 4.2\n";exit}
78 "Error:"
79}
80expect {
81 timeout {puts "TESTING ERROR 4.3\n";exit}
82 "is an invalid filename"
83}
84after 100
85
86send -- "firejail --debug --noprofile --output=\"bla&&bla\"\r"
87expect {
88 timeout {puts "TESTING ERROR 5.2\n";exit}
89 "Error:"
90}
91expect {
92 timeout {puts "TESTING ERROR 5.3\n";exit}
93 "is an invalid filename"
94}
95after 100
96
97send -- "firejail --debug --noprofile --private=\"bla&&bla\"\r"
98expect {
99 timeout {puts "TESTING ERROR 6.1\n";exit}
100 "Checking filename bla&&bla"
101}
102expect {
103 timeout {puts "TESTING ERROR 6.2\n";exit}
104 "Error:"
105}
106expect {
107 timeout {puts "TESTING ERROR 6.3\n";exit}
108 "is an invalid filename"
109}
110after 100
111
112send -- "firejail --debug --noprofile --private-bin=\"bla&&bla\"\r"
113expect {
114 timeout {puts "TESTING ERROR 7.1\n";exit}
115 "Checking filename bla&&bla"
116}
117expect {
118 timeout {puts "TESTING ERROR 7.2\n";exit}
119 "Error:"
120}
121expect {
122 timeout {puts "TESTING ERROR 7.3\n";exit}
123 "is an invalid filename"
124}
125after 100
126
127send -- "firejail --debug --noprofile --private-home=\"bla&&bla\"\r"
128expect {
129 timeout {puts "TESTING ERROR 8.1\n";exit}
130 "Checking filename bla&&bla"
131}
132expect {
133 timeout {puts "TESTING ERROR 8.2\n";exit}
134 "Error:"
135}
136expect {
137 timeout {puts "TESTING ERROR 8.3\n";exit}
138 "is an invalid filename"
139}
140after 100
141
142
143send -- "firejail --debug --noprofile --private-etc=\"bla&&bla\"\r"
144expect {
145 timeout {puts "TESTING ERROR 9.1\n";exit}
146 "Checking filename bla&&bla"
147}
148expect {
149 timeout {puts "TESTING ERROR 9.2\n";exit}
150 "Error:"
151}
152expect {
153 timeout {puts "TESTING ERROR 9.3\n";exit}
154 "is an invalid filename"
155}
156after 100
157
158send -- "firejail --debug --profile=\"bla&&bla\"\r"
159expect {
160 timeout {puts "TESTING ERROR 10.1\n";exit}
161 "Checking filename bla&&bla"
162}
163expect {
164 timeout {puts "TESTING ERROR 10.2\n";exit}
165 "Error:"
166}
167expect {
168 timeout {puts "TESTING ERROR 10.3\n";exit}
169 "is an invalid filename"
170}
171after 100
172
173send -- "firejail --debug --read-only=\"bla&&bla\"\r"
174expect {
175 timeout {puts "TESTING ERROR 11.1\n";exit}
176 "Checking filename bla&&bla"
177}
178expect {
179 timeout {puts "TESTING ERROR 11.2\n";exit}
180 "Error:"
181}
182expect {
183 timeout {puts "TESTING ERROR 11.3\n";exit}
184 "is an invalid filename"
185}
186after 100
187
188send -- "firejail --debug --shell=\"bla&&bla\"\r"
189expect {
190 timeout {puts "TESTING ERROR 12.1\n";exit}
191 "Checking filename bla&&bla"
192}
193expect {
194 timeout {puts "TESTING ERROR 12.2\n";exit}
195 "Error:"
196}
197expect {
198 timeout {puts "TESTING ERROR 12.3\n";exit}
199 "is an invalid filename"
200}
201after 100
202
203send -- "firejail --debug --tmpfs=\"bla&&bla\"\r"
204expect {
205 timeout {puts "TESTING ERROR 13.1\n";exit}
206 "Checking filename bla&&bla"
207}
208expect {
209 timeout {puts "TESTING ERROR 13.2\n";exit}
210 "Error:"
211}
212expect {
213 timeout {puts "TESTING ERROR 13.3\n";exit}
214 "is an invalid filename"
215}
216after 100
217
218send -- "firejail --debug --whitelist=\"bla&&bla\"\r"
219expect {
220 timeout {puts "TESTING ERROR 14.1\n";exit}
221 "Checking filename bla&&bla"
222}
223expect {
224 timeout {puts "TESTING ERROR 14.2\n";exit}
225 "Error:"
226}
227expect {
228 timeout {puts "TESTING ERROR 14.3\n";exit}
229 "is an invalid filename"
230}
231after 100
232
233
234
235puts "\nall done\n"
236
diff --git a/test/private.exp b/test/private.exp
index 6f9dadf8f..8a6796802 100755
--- a/test/private.exp
+++ b/test/private.exp
@@ -12,7 +12,7 @@ if { $argc != 1 } {
12} 12}
13 13
14# testing profile and private 14# testing profile and private
15send -- "firejail --private --profile=/etc/firejail/firefox.profile\r" 15send -- "firejail --private --profile=/etc/firejail/generic.profile\r"
16expect { 16expect {
17 timeout {puts "TESTING ERROR 0\n";exit} 17 timeout {puts "TESTING ERROR 0\n";exit}
18 "Child process initialized" 18 "Child process initialized"
diff --git a/test/profile_apps.exp b/test/profile_apps.exp
deleted file mode 100755
index c57b31489..000000000
--- a/test/profile_apps.exp
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# firefox
8send -- "firejail --profile=/etc/firejail/firefox.profile\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Child process initialized"
12}
13sleep 1
14send -- "exit\r"
15sleep 1
16
17# iceweasel
18send -- "firejail --profile=/etc/firejail/iceweasel.profile\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Child process initialized"
22}
23sleep 1
24send -- "exit\r"
25sleep 1
26
27# evince
28send -- "firejail --profile=/etc/firejail/evince.profile\r"
29expect {
30 timeout {puts "TESTING ERROR 2\n";exit}
31 "Child process initialized"
32}
33sleep 1
34send -- "exit\r"
35sleep 1
36
37# midori
38send -- "firejail --profile=/etc/firejail/midori.profile\r"
39expect {
40 timeout {puts "TESTING ERROR 3\n";exit}
41 "Child process initialized"
42}
43sleep 1
44send -- "exit\r"
45sleep 1
46
47
48puts "\n"
diff --git a/test/test.sh b/test/test.sh
index 7d43a5786..c986b5f29 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -12,6 +12,9 @@ done
12 12
13./fscheck.sh 13./fscheck.sh
14 14
15echo "TESTING: invalid filename"
16./invalid_filename.exp
17
15echo "TESTING: environment variables" 18echo "TESTING: environment variables"
16./env.exp 19./env.exp
17 20
@@ -276,9 +279,6 @@ echo "TESTING: profile read-only"
276echo "TESTING: profile tmpfs" 279echo "TESTING: profile tmpfs"
277./profile_tmpfs.exp 280./profile_tmpfs.exp
278 281
279echo "TESTING: profile applications"
280./profile_apps.exp
281
282echo "TESTING: private" 282echo "TESTING: private"
283./private.exp `whoami` 283./private.exp `whoami`
284 284