aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in10
-rwxr-xr-xtest/appimage/appimage-args.exp4
-rwxr-xr-xtest/appimage/appimage-v1.exp4
-rwxr-xr-xtest/apps-x11-xorg/apps-x11-xorg.sh9
-rwxr-xr-xtest/apps-x11-xorg/firefox.exp4
-rwxr-xr-xtest/apps-x11-xorg/thunderbird.exp4
-rwxr-xr-xtest/apps-x11-xorg/transmission-gtk.exp4
-rwxr-xr-xtest/apps-x11-xorg/transmission-qt.exp85
-rwxr-xr-xtest/compile/compile.sh43
-rwxr-xr-xtest/filters/seccomp-chmod-profile.exp2
-rwxr-xr-xtest/filters/seccomp-chmod.exp2
-rwxr-xr-xtest/filters/seccomp-run-files.exp4
-rwxr-xr-xtest/fs/fscheck-tmpfs.exp43
-rwxr-xr-xtest/fs/mkdir.exp36
-rwxr-xr-xtest/profiles/profiles.sh13
-rwxr-xr-xtest/sysutils/less.exp1
-rwxr-xr-xtest/sysutils/xz.exp5
-rwxr-xr-xtest/utils/join5.exp46
-rw-r--r--test/utils/join5.profile4
-rwxr-xr-xtest/utils/man.exp1
-rwxr-xr-xtest/utils/utils.sh5
21 files changed, 270 insertions, 59 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644
index 000000000..ef1ca73bc
--- /dev/null
+++ b/test/Makefile.in
@@ -0,0 +1,10 @@
1TESTS=$(patsubst %/,%,$(wildcard */))
2
3.PHONY: $(TESTS)
4
5$(TESTS):
6 cd $@ && ./$@.sh 2>&1 | tee $@.log
7 cd $@ && grep -a TESTING $@.log && grep -a -L "TESTING ERROR" $@.log
8
9clean:
10 for test in $(TESTS); do rm -f "$$test/$$test.log"; done
diff --git a/test/appimage/appimage-args.exp b/test/appimage/appimage-args.exp
index 03c7218ac..cee01d509 100755
--- a/test/appimage/appimage-args.exp
+++ b/test/appimage/appimage-args.exp
@@ -56,7 +56,7 @@ expect {
56sleep 2 56sleep 2
57 57
58spawn $env(SHELL) 58spawn $env(SHELL)
59send -- "firemon --seccomp --nowrap\r" 59send -- "firemon --seccomp --wrap\r"
60expect { 60expect {
61 timeout {puts "TESTING ERROR 8\n";exit} 61 timeout {puts "TESTING ERROR 8\n";exit}
62 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit} 62 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
@@ -71,7 +71,7 @@ expect {
71 "name=blablabla" 71 "name=blablabla"
72} 72}
73after 100 73after 100
74send -- "firemon --caps --nowrap\r" 74send -- "firemon --caps --wrap\r"
75expect { 75expect {
76 timeout {puts "TESTING ERROR 11\n";exit} 76 timeout {puts "TESTING ERROR 11\n";exit}
77 "appimage Leafpad" 77 "appimage Leafpad"
diff --git a/test/appimage/appimage-v1.exp b/test/appimage/appimage-v1.exp
index 7b6fa2120..80e228145 100755
--- a/test/appimage/appimage-v1.exp
+++ b/test/appimage/appimage-v1.exp
@@ -44,7 +44,7 @@ expect {
44sleep 2 44sleep 2
45 45
46spawn $env(SHELL) 46spawn $env(SHELL)
47send -- "firemon --seccomp --nowrap\r" 47send -- "firemon --seccomp --wrap\r"
48expect { 48expect {
49 timeout {puts "TESTING ERROR 5\n";exit} 49 timeout {puts "TESTING ERROR 5\n";exit}
50 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit} 50 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
@@ -59,7 +59,7 @@ expect {
59 "name=blablabla" 59 "name=blablabla"
60} 60}
61after 100 61after 100
62send -- "firemon --caps --nowrap\r" 62send -- "firemon --caps --wrap\r"
63expect { 63expect {
64 timeout {puts "TESTING ERROR 6\n";exit} 64 timeout {puts "TESTING ERROR 6\n";exit}
65 "appimage Leafpad" 65 "appimage Leafpad"
diff --git a/test/apps-x11-xorg/apps-x11-xorg.sh b/test/apps-x11-xorg/apps-x11-xorg.sh
index 843fdc50b..568dee85d 100755
--- a/test/apps-x11-xorg/apps-x11-xorg.sh
+++ b/test/apps-x11-xorg/apps-x11-xorg.sh
@@ -25,6 +25,15 @@ else
25 echo "TESTING SKIP: transmission-gtk not found" 25 echo "TESTING SKIP: transmission-gtk not found"
26fi 26fi
27 27
28which transmission-qt 2>/dev/null
29if [ "$?" -eq 0 ];
30then
31 echo "TESTING: transmission-qt x11 xorg"
32 ./transmission-qt.exp
33else
34 echo "TESTING SKIP: transmission-qt not found"
35fi
36
28which thunderbird 2>/dev/null 37which thunderbird 2>/dev/null
29if [ "$?" -eq 0 ]; 38if [ "$?" -eq 0 ];
30then 39then
diff --git a/test/apps-x11-xorg/firefox.exp b/test/apps-x11-xorg/firefox.exp
index 0a43db568..8322e2d0e 100755
--- a/test/apps-x11-xorg/firefox.exp
+++ b/test/apps-x11-xorg/firefox.exp
@@ -41,7 +41,7 @@ expect {
41sleep 2 41sleep 2
42 42
43spawn $env(SHELL) 43spawn $env(SHELL)
44send -- "firemon --seccomp --nowrap\r" 44send -- "firemon --seccomp --wrap\r"
45expect { 45expect {
46 timeout {puts "TESTING ERROR 5\n";exit} 46 timeout {puts "TESTING ERROR 5\n";exit}
47 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit} 47 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
@@ -61,7 +61,7 @@ expect {
61 "name=blablabla" 61 "name=blablabla"
62} 62}
63sleep 1 63sleep 1
64send -- "firemon --caps --nowrap\r" 64send -- "firemon --caps --wrap\r"
65expect { 65expect {
66 timeout {puts "TESTING ERROR 6\n";exit} 66 timeout {puts "TESTING ERROR 6\n";exit}
67 " firefox" {puts "firefox detected\n";} 67 " firefox" {puts "firefox detected\n";}
diff --git a/test/apps-x11-xorg/thunderbird.exp b/test/apps-x11-xorg/thunderbird.exp
index 8cf0ac244..24549e6c8 100755
--- a/test/apps-x11-xorg/thunderbird.exp
+++ b/test/apps-x11-xorg/thunderbird.exp
@@ -38,7 +38,7 @@ expect {
38sleep 2 38sleep 2
39 39
40spawn $env(SHELL) 40spawn $env(SHELL)
41send -- "firemon --seccomp --nowrap\r" 41send -- "firemon --seccomp --wrap\r"
42expect { 42expect {
43 timeout {puts "TESTING ERROR 5\n";exit} 43 timeout {puts "TESTING ERROR 5\n";exit}
44 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit} 44 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
@@ -57,7 +57,7 @@ expect {
57 "name=blablabla" 57 "name=blablabla"
58} 58}
59sleep 2 59sleep 2
60send -- "firemon --caps --nowrap\r" 60send -- "firemon --caps --wrap\r"
61expect { 61expect {
62 timeout {puts "TESTING ERROR 6\n";exit} 62 timeout {puts "TESTING ERROR 6\n";exit}
63 ":firejail" 63 ":firejail"
diff --git a/test/apps-x11-xorg/transmission-gtk.exp b/test/apps-x11-xorg/transmission-gtk.exp
index fdbf388e9..b688bc619 100755
--- a/test/apps-x11-xorg/transmission-gtk.exp
+++ b/test/apps-x11-xorg/transmission-gtk.exp
@@ -38,7 +38,7 @@ expect {
38sleep 2 38sleep 2
39 39
40spawn $env(SHELL) 40spawn $env(SHELL)
41send -- "firemon --seccomp --nowrap\r" 41send -- "firemon --seccomp --wrap\r"
42expect { 42expect {
43 timeout {puts "TESTING ERROR 5\n";exit} 43 timeout {puts "TESTING ERROR 5\n";exit}
44 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit} 44 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
@@ -57,7 +57,7 @@ expect {
57 "name=blablabla" 57 "name=blablabla"
58} 58}
59sleep 1 59sleep 1
60send -- "firemon --caps --nowrap\r" 60send -- "firemon --caps --wrap\r"
61expect { 61expect {
62 timeout {puts "TESTING ERROR 6\n";exit} 62 timeout {puts "TESTING ERROR 6\n";exit}
63 ":firejail" 63 ":firejail"
diff --git a/test/apps-x11-xorg/transmission-qt.exp b/test/apps-x11-xorg/transmission-qt.exp
new file mode 100755
index 000000000..5864bb845
--- /dev/null
+++ b/test/apps-x11-xorg/transmission-qt.exp
@@ -0,0 +1,85 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2020 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test --x11=xorg --ignore=net --ignore=netfilter --ignore=iprange transmission-qt\r"
11sleep 10
12
13spawn $env(SHELL)
14send -- "firejail --list\r"
15expect {
16 timeout {puts "TESTING ERROR 3\n";exit}
17 ":firejail"
18}
19expect {
20 timeout {puts "TESTING ERROR 3.1\n";exit}
21 "transmission-qt"
22}
23sleep 1
24
25# grsecurity exit
26send -- "file /proc/sys/kernel/grsecurity\r"
27expect {
28 timeout {puts "TESTING ERROR - grsecurity detection\n";exit}
29 "grsecurity: directory" {puts "grsecurity present, exiting...\n";exit}
30 "cannot open" {puts "grsecurity not present\n"}
31}
32
33send -- "firejail --name=blablabla\r"
34expect {
35 timeout {puts "TESTING ERROR 4\n";exit}
36 "Child process initialized"
37}
38sleep 2
39
40spawn $env(SHELL)
41send -- "firemon --seccomp --wrap\r"
42expect {
43 timeout {puts "TESTING ERROR 5\n";exit}
44 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
45 ":firejail"
46}
47expect {
48 timeout {puts "TESTING ERROR 5.0\n";exit}
49 "transmission-qt"
50}
51expect {
52 timeout {puts "TESTING ERROR 5.1 (seccomp)\n";exit}
53 "Seccomp: 2"
54}
55expect {
56 timeout {puts "TESTING ERROR 5.1\n";exit}
57 "name=blablabla"
58}
59sleep 1
60send -- "firemon --caps --wrap\r"
61expect {
62 timeout {puts "TESTING ERROR 6\n";exit}
63 ":firejail"
64}
65expect {
66 timeout {puts "TESTING ERROR 6.0\n";exit}
67 "transmission-qt"
68}
69expect {
70 timeout {puts "TESTING ERROR 6.1\n";exit}
71 "CapBnd"
72}
73expect {
74 timeout {puts "TESTING ERROR 6.2\n";exit}
75 "0000000000000000"
76}
77expect {
78 timeout {puts "TESTING ERROR 6.3\n";exit}
79 "name=blablabla"
80}
81sleep 1
82send -- "firejail --shutdown=test\r"
83sleep 3
84
85puts "\nall done\n"
diff --git a/test/compile/compile.sh b/test/compile/compile.sh
index 2f9e0ece6..91fcfb85d 100755
--- a/test/compile/compile.sh
+++ b/test/compile/compile.sh
@@ -4,7 +4,7 @@
4# License GPL v2 4# License GPL v2
5 5
6arr[1]="TEST 1: standard compilation" 6arr[1]="TEST 1: standard compilation"
7arr[2]="TEST 2: compile seccomp disabled" 7arr[2]="TEST 2: compile dbus proxy disabled"
8arr[3]="TEST 3: compile chroot disabled" 8arr[3]="TEST 3: compile chroot disabled"
9arr[4]="TEST 4: compile firetunnel disabled" 9arr[4]="TEST 4: compile firetunnel disabled"
10arr[5]="TEST 5: compile user namespace disabled" 10arr[5]="TEST 5: compile user namespace disabled"
@@ -17,13 +17,16 @@ arr[11]="TEST 11: compile disable global config"
17arr[12]="TEST 12: compile apparmor" 17arr[12]="TEST 12: compile apparmor"
18arr[13]="TEST 13: compile busybox" 18arr[13]="TEST 13: compile busybox"
19arr[14]="TEST 14: compile overlayfs disabled" 19arr[14]="TEST 14: compile overlayfs disabled"
20arr[14]="TEST 15: compile private-home disabled" 20arr[15]="TEST 15: compile private-home disabled"
21arr[15]="TEST 16: compile disable manpages"
21 22
22# remove previous reports and output file 23# remove previous reports and output file
23cleanup() { 24cleanup() {
24 rm -f report* 25 rm -f report*
25 rm -fr firejail 26 rm -fr firejail
26 rm -f oc* om* 27 rm -f oc* om*
28 rm -f output-configure
29 rm -f output-make
27} 30}
28 31
29print_title() { 32print_title() {
@@ -77,13 +80,12 @@ rm output-configure output-make
77#***************************************************************** 80#*****************************************************************
78# TEST 2 81# TEST 2
79#***************************************************************** 82#*****************************************************************
80# - disable seccomp configuration 83# - disable dbus proxy configuration
81#***************************************************************** 84#*****************************************************************
82print_title "${arr[2]}" 85print_title "${arr[2]}"
83# seccomp
84cd firejail 86cd firejail
85make distclean 87make distclean
86./configure --prefix=/usr --disable-seccomp --enable-fatal-warnings 2>&1 | tee ../output-configure 88./configure --prefix=/usr --disable-dbusproxy --enable-fatal-warnings 2>&1 | tee ../output-configure
87make -j4 2>&1 | tee ../output-make 89make -j4 2>&1 | tee ../output-make
88cd .. 90cd ..
89grep Warning output-configure output-make > ./report-test2 91grep Warning output-configure output-make > ./report-test2
@@ -98,7 +100,6 @@ rm output-configure output-make
98# - disable chroot configuration 100# - disable chroot configuration
99#***************************************************************** 101#*****************************************************************
100print_title "${arr[3]}" 102print_title "${arr[3]}"
101# seccomp
102cd firejail 103cd firejail
103make distclean 104make distclean
104./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure 105./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -116,7 +117,6 @@ rm output-configure output-make
116# - disable firetunnel configuration 117# - disable firetunnel configuration
117#***************************************************************** 118#*****************************************************************
118print_title "${arr[4]}" 119print_title "${arr[4]}"
119# seccomp
120cd firejail 120cd firejail
121make distclean 121make distclean
122./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure 122./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -134,7 +134,6 @@ rm output-configure output-make
134# - disable user namespace configuration 134# - disable user namespace configuration
135#***************************************************************** 135#*****************************************************************
136print_title "${arr[5]}" 136print_title "${arr[5]}"
137# seccomp
138cd firejail 137cd firejail
139make distclean 138make distclean
140./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure 139./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -153,7 +152,6 @@ rm output-configure output-make
153# - check compilation 152# - check compilation
154#***************************************************************** 153#*****************************************************************
155print_title "${arr[6]}" 154print_title "${arr[6]}"
156# seccomp
157cd firejail 155cd firejail
158make distclean 156make distclean
159./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure 157./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -171,7 +169,6 @@ rm output-configure output-make
171# - disable X11 support 169# - disable X11 support
172#***************************************************************** 170#*****************************************************************
173print_title "${arr[7]}" 171print_title "${arr[7]}"
174# seccomp
175cd firejail 172cd firejail
176make distclean 173make distclean
177./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure 174./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -189,7 +186,6 @@ rm output-configure output-make
189# - enable selinux 186# - enable selinux
190#***************************************************************** 187#*****************************************************************
191print_title "${arr[8]}" 188print_title "${arr[8]}"
192# seccomp
193cd firejail 189cd firejail
194make distclean 190make distclean
195./configure --prefix=/usr --enable-selinux --enable-fatal-warnings 2>&1 | tee ../output-configure 191./configure --prefix=/usr --enable-selinux --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -207,7 +203,6 @@ rm output-configure output-make
207# - disable file transfer 203# - disable file transfer
208#***************************************************************** 204#*****************************************************************
209print_title "${arr[9]}" 205print_title "${arr[9]}"
210# seccomp
211cd firejail 206cd firejail
212make distclean 207make distclean
213./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure 208./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -225,7 +220,6 @@ rm output-configure output-make
225# - disable whitelist 220# - disable whitelist
226#***************************************************************** 221#*****************************************************************
227print_title "${arr[10]}" 222print_title "${arr[10]}"
228# seccomp
229cd firejail 223cd firejail
230make distclean 224make distclean
231./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure 225./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -243,7 +237,6 @@ rm output-configure output-make
243# - disable global config 237# - disable global config
244#***************************************************************** 238#*****************************************************************
245print_title "${arr[11]}" 239print_title "${arr[11]}"
246# seccomp
247cd firejail 240cd firejail
248make distclean 241make distclean
249./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure 242./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -261,7 +254,6 @@ rm output-configure output-make
261# - enable apparmor 254# - enable apparmor
262#***************************************************************** 255#*****************************************************************
263print_title "${arr[12]}" 256print_title "${arr[12]}"
264# seccomp
265cd firejail 257cd firejail
266make distclean 258make distclean
267./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure 259./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -279,7 +271,6 @@ rm output-configure output-make
279# - enable busybox workaround 271# - enable busybox workaround
280#***************************************************************** 272#*****************************************************************
281print_title "${arr[13]}" 273print_title "${arr[13]}"
282# seccomp
283cd firejail 274cd firejail
284make distclean 275make distclean
285./configure --prefix=/usr --enable-busybox-workaround --enable-fatal-warnings 2>&1 | tee ../output-configure 276./configure --prefix=/usr --enable-busybox-workaround --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -297,7 +288,6 @@ rm output-configure output-make
297# - disable overlayfs 288# - disable overlayfs
298#***************************************************************** 289#*****************************************************************
299print_title "${arr[14]}" 290print_title "${arr[14]}"
300# seccomp
301cd firejail 291cd firejail
302make distclean 292make distclean
303./configure --prefix=/usr --disable-overlayfs --enable-fatal-warnings 2>&1 | tee ../output-configure 293./configure --prefix=/usr --disable-overlayfs --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -315,7 +305,6 @@ rm output-configure output-make
315# - disable private home 305# - disable private home
316#***************************************************************** 306#*****************************************************************
317print_title "${arr[15]}" 307print_title "${arr[15]}"
318# seccomp
319cd firejail 308cd firejail
320make distclean 309make distclean
321./configure --prefix=/usr --disable-private-home --enable-fatal-warnings 2>&1 | tee ../output-configure 310./configure --prefix=/usr --disable-private-home --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -328,6 +317,23 @@ cp output-make om15
328rm output-configure output-make 317rm output-configure output-make
329 318
330#***************************************************************** 319#*****************************************************************
320# TEST 16
321#*****************************************************************
322# - disable manpages
323#*****************************************************************
324print_title "${arr[16]}"
325cd firejail
326make distclean
327./configure --prefix=/usr --disable-man --enable-fatal-warnings 2>&1 | tee ../output-configure
328make -j4 2>&1 | tee ../output-make
329cd ..
330grep Warning output-configure output-make > ./report-test16
331grep Error output-configure output-make >> ./report-test16
332cp output-configure oc16
333cp output-make om16
334rm output-configure output-make
335
336#*****************************************************************
331# PRINT REPORTS 337# PRINT REPORTS
332#***************************************************************** 338#*****************************************************************
333echo 339echo
@@ -356,3 +362,4 @@ echo ${arr[12]}
356echo ${arr[13]} 362echo ${arr[13]}
357echo ${arr[14]} 363echo ${arr[14]}
358echo ${arr[15]} 364echo ${arr[15]}
365echo ${arr[16]}
diff --git a/test/filters/seccomp-chmod-profile.exp b/test/filters/seccomp-chmod-profile.exp
index 9b61397ca..22392f882 100755
--- a/test/filters/seccomp-chmod-profile.exp
+++ b/test/filters/seccomp-chmod-profile.exp
@@ -41,7 +41,7 @@ expect {
41send -- "chmod +x testfile; echo done\r" 41send -- "chmod +x testfile; echo done\r"
42expect { 42expect {
43 timeout {puts "TESTING ERROR 5\n";exit} 43 timeout {puts "TESTING ERROR 5\n";exit}
44 "Bad system call" 44 "Operation not permitted"
45} 45}
46expect { 46expect {
47 timeout {puts "TESTING ERROR 6\n";exit} 47 timeout {puts "TESTING ERROR 6\n";exit}
diff --git a/test/filters/seccomp-chmod.exp b/test/filters/seccomp-chmod.exp
index 01b9cbaac..c72a68c82 100755
--- a/test/filters/seccomp-chmod.exp
+++ b/test/filters/seccomp-chmod.exp
@@ -41,7 +41,7 @@ expect {
41send -- "chmod +x testfile; echo done\r" 41send -- "chmod +x testfile; echo done\r"
42expect { 42expect {
43 timeout {puts "TESTING ERROR 5\n";exit} 43 timeout {puts "TESTING ERROR 5\n";exit}
44 "Bad system call" 44 "Operation not permitted"
45} 45}
46expect { 46expect {
47 timeout {puts "TESTING ERROR 6\n";exit} 47 timeout {puts "TESTING ERROR 6\n";exit}
diff --git a/test/filters/seccomp-run-files.exp b/test/filters/seccomp-run-files.exp
index fd3033a69..5f468cf24 100755
--- a/test/filters/seccomp-run-files.exp
+++ b/test/filters/seccomp-run-files.exp
@@ -24,7 +24,7 @@ after 100
24send -- "ls -l /run/firejail/mnt/seccomp | grep -c seccomp\r" 24send -- "ls -l /run/firejail/mnt/seccomp | grep -c seccomp\r"
25expect { 25expect {
26 timeout {puts "TESTING ERROR 3\n";exit} 26 timeout {puts "TESTING ERROR 3\n";exit}
27 "5" 27 "6"
28} 28}
29send -- "exit\r" 29send -- "exit\r"
30sleep 1 30sleep 1
@@ -90,7 +90,7 @@ after 100
90send -- "ls -l /run/firejail/mnt/seccomp | grep -c seccomp\r" 90send -- "ls -l /run/firejail/mnt/seccomp | grep -c seccomp\r"
91expect { 91expect {
92 timeout {puts "TESTING ERROR 18\n";exit} 92 timeout {puts "TESTING ERROR 18\n";exit}
93 "6" 93 "8"
94} 94}
95send -- "exit\r" 95send -- "exit\r"
96sleep 1 96sleep 1
diff --git a/test/fs/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp
index ebd3eeb9c..818549fe2 100755
--- a/test/fs/fscheck-tmpfs.exp
+++ b/test/fs/fscheck-tmpfs.exp
@@ -7,12 +7,49 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10# .. 10send -- "mkdir -p ~/fjtest-dir/fjtest-dir\r"
11send -- "firejail --tmpfs=fscheck-dir\r" 11after 100
12send -- "mkdir /tmp/fjtest-dir\r"
13after 100
14
15if { ! [file exists ~/fjtest-dir/fjtest-dir] } {
16 puts "TESTING ERROR 1\n"
17 exit
18}
19if { ! [file exists /tmp/fjtest-dir] } {
20 puts "TESTING ERROR 2\n"
21 exit
22}
23
24send -- "firejail --noprofile --tmpfs=~/fjtest-dir\r"
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "Child process initialized"
28}
29after 500
30
31send -- "ls ~/fjtest-dir/fjtest-dir\r"
32expect {
33 timeout {puts "TESTING ERROR 4\n";exit}
34 "No such file or directory"
35}
36after 500
37
38send -- "exit\r"
39after 500
40
41send -- "firejail --noprofile --tmpfs=/tmp/fjtest-dir\r"
12expect { 42expect {
13 timeout {puts "TESTING ERROR 0.1\n";exit} 43 timeout {puts "TESTING ERROR 5\n";exit}
14 "Error" 44 "Error"
15} 45}
46after 500
47
48# cleanup
49send -- "rm -fr ~/fjtest-dir\r"
16after 100 50after 100
51send -- "rm -fr /tmp/fjtest-dir\r"
52after 100
53
17 54
18puts "\nall done\n" 55puts "\nall done\n"
diff --git a/test/fs/mkdir.exp b/test/fs/mkdir.exp
index 59005e1a2..61029ec18 100755
--- a/test/fs/mkdir.exp
+++ b/test/fs/mkdir.exp
@@ -7,11 +7,12 @@ set timeout 3
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "rm -fr ~/.firejail_test\r"
11after 100
12
10send -- "firejail --profile=mkdir.profile find ~/.firejail_test\r" 13send -- "firejail --profile=mkdir.profile find ~/.firejail_test\r"
11expect { 14expect {
12 timeout {puts "TESTING ERROR 1.1\n";exit} 15 timeout {puts "TESTING ERROR 1.1\n";exit}
13 "Warning: cannot create" { puts "TESTING ERROR 1.2\n";exit}
14 "No such file or directory" { puts "TESTING ERROR 1.3\n";exit}
15 ".firejail_test/a/b/c/d.txt" 16 ".firejail_test/a/b/c/d.txt"
16} 17}
17send -- "rm -rf ~/.firejail_test\r" 18send -- "rm -rf ~/.firejail_test\r"
@@ -20,30 +21,29 @@ after 100
20send -- "firejail --profile=mkdir.profile find /tmp/.firejail_test\r" 21send -- "firejail --profile=mkdir.profile find /tmp/.firejail_test\r"
21expect { 22expect {
22 timeout {puts "TESTING ERROR 2.1\n";exit} 23 timeout {puts "TESTING ERROR 2.1\n";exit}
23 "Warning: cannot create" { puts "TESTING ERROR 2.2\n";exit}
24 "No such file or directory" { puts "TESTING ERROR 2.3\n";exit}
25 "/tmp/.firejail_test/a/b/c/d.txt" 24 "/tmp/.firejail_test/a/b/c/d.txt"
26} 25}
27send -- "rm -rf /tmp/.firejail_test\r" 26send -- "rm -rf /tmp/.firejail_test\r"
28after 100 27after 100
29 28
30set UID [exec id -u] 29set UID [exec id -u]
31send -- "firejail --profile=mkdir.profile find /run/user/$UID/.firejail_test\r" 30set fexist [file exist /run/user/$UID]
32expect { 31if { $fexist } {
33 timeout {puts "TESTING ERROR 3.1\n";exit} 32 send -- "firejail --profile=mkdir.profile find /run/user/$UID/.firejail_test\r"
34 "Warning: cannot create" { puts "TESTING ERROR 3.2\n";exit} 33 expect {
35 "No such file or directory" { puts "TESTING ERROR 3.3\n";exit} 34 timeout {puts "TESTING ERROR 3.1\n";exit}
36 "/run/user/$UID/.firejail_test/a/b/c/d.txt" 35 "/run/user/$UID/.firejail_test/a/b/c/d.txt"
37} 36 }
38send -- "rm -rf /run/user/$UID/.firejail_test\r" 37 send -- "rm -rf /run/user/$UID/.firejail_test\r"
39after 100 38 after 100
40 39
41 40
42send -- "firejail --profile=mkdir2.profile\r" 41 send -- "firejail --profile=mkdir2.profile\r"
43expect { 42 expect {
44 timeout {puts "TESTING ERROR 4\n";exit} 43 timeout {puts "TESTING ERROR 4\n";exit}
45 "only files or directories in user home, /tmp, or /run/user/<UID>" 44 "only files or directories in user home, /tmp, or /run/user/<UID>"
45 }
46 after 100
46} 47}
47after 100
48 48
49puts "\nall done\n" 49puts "\nall done\n"
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh
index 69f0dc086..2d7d2a966 100755
--- a/test/profiles/profiles.sh
+++ b/test/profiles/profiles.sh
@@ -34,11 +34,16 @@ echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)"
34echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" 34echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)"
35./profile_noperm.exp 35./profile_noperm.exp
36 36
37# GitHub CI doesn't have a /run/user/$UID directory. Using it to test a small number of profiles.
38UID=`id -u`
39if [ -d "/run/user/$UID" ]; then
40 PROFILES=`ls /etc/firejail/*.profile`
41 echo "TESTING: default profiles installed in /etc"
42else
43 PROFILES=`ls /etc/firejail/transmission*.profile /etc/firejail/fi*.profile /etc/firejail/fl*.profile /etc/firejail/free*.profile`
44 echo "TESTING: small number of default profiles installed in /etc"
45fi
37 46
38
39
40echo "TESTING: default profiles installed in /etc"
41PROFILES=`ls /etc/firejail/*.profile`
42for PROFILE in $PROFILES 47for PROFILE in $PROFILES
43do 48do
44 echo "TESTING: $PROFILE" 49 echo "TESTING: $PROFILE"
diff --git a/test/sysutils/less.exp b/test/sysutils/less.exp
index 2bfb60302..daa666c18 100755
--- a/test/sysutils/less.exp
+++ b/test/sysutils/less.exp
@@ -10,6 +10,7 @@ match_max 100000
10send -- "firejail less sysutils.sh\r" 10send -- "firejail less sysutils.sh\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 1\n";exit} 12 timeout {puts "TESTING ERROR 1\n";exit}
13 "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit}
13 "MALLOC_CHECK" 14 "MALLOC_CHECK"
14} 15}
15expect { 16expect {
diff --git a/test/sysutils/xz.exp b/test/sysutils/xz.exp
index 63b1ad3c7..074b90076 100755
--- a/test/sysutils/xz.exp
+++ b/test/sysutils/xz.exp
@@ -3,7 +3,7 @@
3# Copyright (C) 2014-2020 Firejail Authors 3# Copyright (C) 2014-2020 Firejail Authors
4# License GPL v2 4# License GPL v2
5 5
6set timeout 10 6set timeout 60
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
@@ -13,6 +13,9 @@ sleep 1
13send -- "firejail /usr/bin/xz -c /usr/bin/firejail > firejail_t2\r" 13send -- "firejail /usr/bin/xz -c /usr/bin/firejail > firejail_t2\r"
14sleep 1 14sleep 1
15 15
16send -- "md5sum firejail_t1 firejail_t2; ls -l firejail_t1 firejail_t2\r"
17sleep 1
18
16send -- "diff -s firejail_t1 firejail_t2\r" 19send -- "diff -s firejail_t1 firejail_t2\r"
17expect { 20expect {
18 timeout {puts "TESTING ERROR 1\n";exit} 21 timeout {puts "TESTING ERROR 1\n";exit}
diff --git a/test/utils/join5.exp b/test/utils/join5.exp
new file mode 100755
index 000000000..43ca09b4d
--- /dev/null
+++ b/test/utils/join5.exp
@@ -0,0 +1,46 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2020 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test123 --profile=join5.profile\r"
11expect {
12 timeout {puts "TESTING ERROR 5\n";exit}
13 "Child process initialized"
14}
15sleep 1
16spawn $env(SHELL)
17send -- "firejail --join=test123\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "Switching to pid"
21}
22sleep 1
23send -- "ps aux\r"
24expect {
25 timeout {puts "TESTING ERROR 2\n";exit}
26 "/bin/bash"
27}
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "/bin/bash"
31}
32
33send -- "exit\r"
34after 100
35
36send -- "firejail --protocol.print=test123\r"
37expect {
38 timeout {puts "TESTING ERROR 4\n";exit}
39 "Switching to pid"
40}
41expect {
42 timeout {puts "TESTING ERROR 5\n";exit}
43 "unix"
44}
45
46puts "\nall done\n"
diff --git a/test/utils/join5.profile b/test/utils/join5.profile
new file mode 100644
index 000000000..e9eb37a4f
--- /dev/null
+++ b/test/utils/join5.profile
@@ -0,0 +1,4 @@
1dbus-user filter
2dbus-system none
3seccomp
4protocol unix
diff --git a/test/utils/man.exp b/test/utils/man.exp
index 3cde9f2c8..102701a6a 100755
--- a/test/utils/man.exp
+++ b/test/utils/man.exp
@@ -10,6 +10,7 @@ match_max 100000
10send -- "man firejail\r" 10send -- "man firejail\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 0\n";exit}
13 "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit}
13 "Linux namespaces sandbox program" 14 "Linux namespaces sandbox program"
14} 15}
15after 100 16after 100
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index 48a8051fa..7e8426f35 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -99,9 +99,12 @@ echo "TESTING: join2 (test/utils/join2.exp)"
99echo "TESTING: join3 (test/utils/join3.exp)" 99echo "TESTING: join3 (test/utils/join3.exp)"
100./join3.exp 100./join3.exp
101 101
102echo "TESTING: join3 (test/utils/join4.exp)" 102echo "TESTING: join4 (test/utils/join4.exp)"
103./join4.exp 103./join4.exp
104 104
105echo "TESTING: join5 (test/utils/join5.exp)"
106./join5.exp
107
105echo "TESTING: join profile (test/utils/join-profile.exp)" 108echo "TESTING: join profile (test/utils/join-profile.exp)"
106./join-profile.exp 109./join-profile.exp
107 110