diff options
author | netblue30 <netblue30@protonmail.com> | 2022-09-26 10:26:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 10:26:18 -0400 |
commit | 9c3f967ba8e5c2fcb524825e2dbcc3bd27c93b63 (patch) | |
tree | 2a53b224b8e1604b840b4c338980ae7581559395 | |
parent | Merge pull request #5371 from kmk3/profiles-allow-exiftool (diff) | |
parent | tests: remove stray ; (diff) | |
download | firejail-9c3f967ba8e5c2fcb524825e2dbcc3bd27c93b63.tar.gz firejail-9c3f967ba8e5c2fcb524825e2dbcc3bd27c93b63.tar.zst firejail-9c3f967ba8e5c2fcb524825e2dbcc3bd27c93b63.zip |
Remove deprecated syntax and modernize shell test scripts
-rwxr-xr-x | contrib/gdb-firejail.sh | 2 | ||||
-rwxr-xr-x | test/appimage/appimage.sh | 2 | ||||
-rwxr-xr-x | test/apps-x11-xorg/apps-x11-xorg.sh | 12 | ||||
-rwxr-xr-x | test/apps-x11/apps-x11.sh | 44 | ||||
-rwxr-xr-x | test/apps/apps.sh | 8 | ||||
-rwxr-xr-x | test/chroot/chroot.sh | 2 | ||||
-rwxr-xr-x | test/compile/compile.sh | 95 | ||||
-rwxr-xr-x | test/environment/environment.sh | 24 | ||||
-rwxr-xr-x | test/environment/output.sh | 6 | ||||
-rwxr-xr-x | test/fcopy/fcopy.sh | 4 | ||||
-rwxr-xr-x | test/features/test.sh | 87 | ||||
-rwxr-xr-x | test/filters/filters.sh | 77 | ||||
-rwxr-xr-x | test/fnetfilter/fnetfilter.sh | 2 | ||||
-rwxr-xr-x | test/fs/fs.sh | 28 | ||||
-rwxr-xr-x | test/overlay/overlay.sh | 24 | ||||
-rwxr-xr-x | test/private-lib/private-lib.sh | 8 | ||||
-rwxr-xr-x | test/profiles/all-profiles.sh | 8 | ||||
-rwxr-xr-x | test/profiles/profiles.sh | 8 | ||||
-rwxr-xr-x | test/root/root.sh | 21 | ||||
-rwxr-xr-x | test/stress/stress.sh | 2 | ||||
-rwxr-xr-x | test/sysutils/sysutils.sh | 27 | ||||
-rwxr-xr-x | test/utils/catchsignal.sh | 26 | ||||
-rwxr-xr-x | test/utils/catchsignal2.sh | 66 | ||||
-rwxr-xr-x | test/utils/utils.sh | 19 |
24 files changed, 278 insertions, 324 deletions
diff --git a/contrib/gdb-firejail.sh b/contrib/gdb-firejail.sh index 397438e1e..35348088e 100755 --- a/contrib/gdb-firejail.sh +++ b/contrib/gdb-firejail.sh | |||
@@ -17,7 +17,7 @@ if [ -z "${1##*/firejail}" ]; then | |||
17 | else | 17 | else |
18 | # First argument is not named firejail, then add default unless environment | 18 | # First argument is not named firejail, then add default unless environment |
19 | # variable already set. | 19 | # variable already set. |
20 | set -- ${FIREJAIL:=$(which firejail)} "$@" | 20 | set -- ${FIREJAIL:=$(command -v firejail)} "$@" |
21 | fi | 21 | fi |
22 | 22 | ||
23 | bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" & | 23 | bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" & |
diff --git a/test/appimage/appimage.sh b/test/appimage/appimage.sh index 9afacf5be..c2bdad012 100755 --- a/test/appimage/appimage.sh +++ b/test/appimage/appimage.sh | |||
@@ -13,7 +13,7 @@ echo "TESTING: AppImage v1 (test/appimage/appimage-v1.exp)" | |||
13 | echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" | 13 | echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" |
14 | ./appimage-v2.exp | 14 | ./appimage-v2.exp |
15 | 15 | ||
16 | echo "TESTING: AppImage file name (test/appimage/filename.exp)"; | 16 | echo "TESTING: AppImage file name (test/appimage/filename.exp)" |
17 | ./filename.exp | 17 | ./filename.exp |
18 | 18 | ||
19 | echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)" | 19 | echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)" |
diff --git a/test/apps-x11-xorg/apps-x11-xorg.sh b/test/apps-x11-xorg/apps-x11-xorg.sh index 9ed123979..9dcee7aff 100755 --- a/test/apps-x11-xorg/apps-x11-xorg.sh +++ b/test/apps-x11-xorg/apps-x11-xorg.sh | |||
@@ -7,8 +7,7 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | which firefox 2>/dev/null | 10 | if command -v firefox |
11 | if [ "$?" -eq 0 ]; | ||
12 | then | 11 | then |
13 | echo "TESTING: firefox x11 xorg" | 12 | echo "TESTING: firefox x11 xorg" |
14 | ./firefox.exp | 13 | ./firefox.exp |
@@ -16,8 +15,7 @@ else | |||
16 | echo "TESTING SKIP: firefox not found" | 15 | echo "TESTING SKIP: firefox not found" |
17 | fi | 16 | fi |
18 | 17 | ||
19 | which transmission-gtk 2>/dev/null | 18 | if command -v transmission-gtk |
20 | if [ "$?" -eq 0 ]; | ||
21 | then | 19 | then |
22 | echo "TESTING: transmission-gtk x11 xorg" | 20 | echo "TESTING: transmission-gtk x11 xorg" |
23 | ./transmission-gtk.exp | 21 | ./transmission-gtk.exp |
@@ -25,8 +23,7 @@ else | |||
25 | echo "TESTING SKIP: transmission-gtk not found" | 23 | echo "TESTING SKIP: transmission-gtk not found" |
26 | fi | 24 | fi |
27 | 25 | ||
28 | which transmission-qt 2>/dev/null | 26 | if command -v transmission-qt |
29 | if [ "$?" -eq 0 ]; | ||
30 | then | 27 | then |
31 | echo "TESTING: transmission-qt x11 xorg" | 28 | echo "TESTING: transmission-qt x11 xorg" |
32 | ./transmission-qt.exp | 29 | ./transmission-qt.exp |
@@ -34,8 +31,7 @@ else | |||
34 | echo "TESTING SKIP: transmission-qt not found" | 31 | echo "TESTING SKIP: transmission-qt not found" |
35 | fi | 32 | fi |
36 | 33 | ||
37 | which thunderbird 2>/dev/null | 34 | if command -v thunderbird |
38 | if [ "$?" -eq 0 ]; | ||
39 | then | 35 | then |
40 | echo "TESTING: thunderbird x11 xorg" | 36 | echo "TESTING: thunderbird x11 xorg" |
41 | ./thunderbird.exp | 37 | ./thunderbird.exp |
diff --git a/test/apps-x11/apps-x11.sh b/test/apps-x11/apps-x11.sh index a3c946ca4..b2722eed3 100755 --- a/test/apps-x11/apps-x11.sh +++ b/test/apps-x11/apps-x11.sh | |||
@@ -10,49 +10,42 @@ export LC_ALL=C | |||
10 | echo "TESTING: no x11 (test/apps-x11/x11-none.exp)" | 10 | echo "TESTING: no x11 (test/apps-x11/x11-none.exp)" |
11 | ./x11-none.exp | 11 | ./x11-none.exp |
12 | 12 | ||
13 | 13 | if command -v xterm | |
14 | which xterm 2>/dev/null | ||
15 | if [ "$?" -eq 0 ]; | ||
16 | then | 14 | then |
17 | echo "TESTING: xterm x11 xorg" | 15 | echo "TESTING: xterm x11 xorg" |
18 | ./xterm-xorg.exp | 16 | ./xterm-xorg.exp |
19 | 17 | ||
20 | which xpra 2>/dev/null | 18 | if command -v xpra |
21 | if [ "$?" -eq 0 ]; | ||
22 | then | 19 | then |
23 | echo "TESTING: xterm x11 xpra" | 20 | echo "TESTING: xterm x11 xpra" |
24 | ./xterm-xpra.exp | 21 | ./xterm-xpra.exp |
25 | fi | 22 | fi |
26 | 23 | ||
27 | which Xephyr 2>/dev/null | 24 | if command -v Xephyr |
28 | if [ "$?" -eq 0 ]; | ||
29 | then | 25 | then |
30 | echo "TESTING: xterm x11 xephyr" | 26 | echo "TESTING: xterm x11 xephyr" |
31 | ./xterm-xephyr.exp | 27 | ./xterm-xephyr.exp |
32 | fi | 28 | fi |
33 | else | 29 | else |
34 | echo "TESTING SKIP: xterm not found" | 30 | echo "TESTING SKIP: xterm not found" |
35 | fi | 31 | fi |
36 | 32 | ||
37 | # check xpra/xephyr | 33 | # check xpra/xephyr |
38 | which xpra 2>/dev/null | 34 | if command -v xpra |
39 | if [ "$?" -eq 0 ]; | ||
40 | then | 35 | then |
41 | echo "xpra found" | 36 | echo "xpra found" |
42 | else | 37 | else |
43 | echo "xpra not found" | 38 | echo "xpra not found" |
44 | which Xephyr 2>/dev/null | 39 | if command -v Xephyr |
45 | if [ "$?" -eq 0 ]; | ||
46 | then | 40 | then |
47 | echo "Xephyr found" | 41 | echo "Xephyr found" |
48 | else | 42 | else |
49 | echo "TESTING SKIP: xpra and/or Xephyr not found" | 43 | echo "TESTING SKIP: xpra and/or Xephyr not found" |
50 | exit | 44 | exit |
51 | fi | 45 | fi |
52 | fi | 46 | fi |
53 | 47 | ||
54 | which firefox 2>/dev/null | 48 | if command -v firefox |
55 | if [ "$?" -eq 0 ]; | ||
56 | then | 49 | then |
57 | echo "TESTING: firefox x11" | 50 | echo "TESTING: firefox x11" |
58 | ./firefox.exp | 51 | ./firefox.exp |
@@ -60,8 +53,7 @@ else | |||
60 | echo "TESTING SKIP: firefox not found" | 53 | echo "TESTING SKIP: firefox not found" |
61 | fi | 54 | fi |
62 | 55 | ||
63 | which chromium 2>/dev/null | 56 | if command -v chromium |
64 | if [ "$?" -eq 0 ]; | ||
65 | then | 57 | then |
66 | echo "TESTING: chromium x11" | 58 | echo "TESTING: chromium x11" |
67 | ./chromium.exp | 59 | ./chromium.exp |
@@ -69,8 +61,7 @@ else | |||
69 | echo "TESTING SKIP: chromium not found" | 61 | echo "TESTING SKIP: chromium not found" |
70 | fi | 62 | fi |
71 | 63 | ||
72 | which transmission-gtk 2>/dev/null | 64 | if command -v transmission-gtk |
73 | if [ "$?" -eq 0 ]; | ||
74 | then | 65 | then |
75 | echo "TESTING: transmission-gtk x11" | 66 | echo "TESTING: transmission-gtk x11" |
76 | ./transmission-gtk.exp | 67 | ./transmission-gtk.exp |
@@ -78,8 +69,7 @@ else | |||
78 | echo "TESTING SKIP: transmission-gtk not found" | 69 | echo "TESTING SKIP: transmission-gtk not found" |
79 | fi | 70 | fi |
80 | 71 | ||
81 | which thunderbird 2>/dev/null | 72 | if command -v thunderbird |
82 | if [ "$?" -eq 0 ]; | ||
83 | then | 73 | then |
84 | echo "TESTING: thunderbird x11" | 74 | echo "TESTING: thunderbird x11" |
85 | ./thunderbird.exp | 75 | ./thunderbird.exp |
diff --git a/test/apps/apps.sh b/test/apps/apps.sh index 83e977ba0..0ef01bf2e 100755 --- a/test/apps/apps.sh +++ b/test/apps/apps.sh | |||
@@ -7,12 +7,10 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | LIST="firefox midori chromium opera transmission-qt qbittorrent uget-gtk filezilla gthumb thunderbird " | 10 | apps=(firefox midori chromium opera transmission-qt qbittorrent uget-gtk filezilla gthumb thunderbird vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat) |
11 | LIST+="vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat" | ||
12 | 11 | ||
13 | for app in $LIST; do | 12 | for app in "${apps[@]}"; do |
14 | which $app 2>/dev/null | 13 | if command -v "$app" |
15 | if [ "$?" -eq 0 ]; | ||
16 | then | 14 | then |
17 | echo "TESTING: $app" | 15 | echo "TESTING: $app" |
18 | ./$app.exp | 16 | ./$app.exp |
diff --git a/test/chroot/chroot.sh b/test/chroot/chroot.sh index 3c3e7311b..f5ccf3549 100755 --- a/test/chroot/chroot.sh +++ b/test/chroot/chroot.sh | |||
@@ -17,6 +17,4 @@ echo "TESTING: chroot (test/chroot/fs_chroot.exp)" | |||
17 | echo "TESTING: unchroot as root (test/chroot/unchroot-as-root.exp)" | 17 | echo "TESTING: unchroot as root (test/chroot/unchroot-as-root.exp)" |
18 | sudo ./unchroot-as-root.exp | 18 | sudo ./unchroot-as-root.exp |
19 | 19 | ||
20 | |||
21 | |||
22 | rm -f unchroot | 20 | rm -f unchroot |
diff --git a/test/compile/compile.sh b/test/compile/compile.sh index 6b994ba70..0285c8935 100755 --- a/test/compile/compile.sh +++ b/test/compile/compile.sh | |||
@@ -31,7 +31,7 @@ arr[15]="TEST 15: compile private-home disabled" | |||
31 | arr[16]="TEST 16: compile disable manpages" | 31 | arr[16]="TEST 16: compile disable manpages" |
32 | arr[17]="TEST 17: disable tmpfs as regular user" | 32 | arr[17]="TEST 17: disable tmpfs as regular user" |
33 | arr[18]="TEST 18: disable private home" | 33 | arr[18]="TEST 18: disable private home" |
34 | arr[18]="TEST 19: enable ids" | 34 | arr[19]="TEST 19: enable ids" |
35 | 35 | ||
36 | # remove previous reports and output file | 36 | # remove previous reports and output file |
37 | cleanup() { | 37 | cleanup() { |
@@ -47,23 +47,23 @@ print_title() { | |||
47 | echo | 47 | echo |
48 | echo | 48 | echo |
49 | echo "**************************************************" | 49 | echo "**************************************************" |
50 | echo $1 | 50 | echo "$1" |
51 | echo "**************************************************" | 51 | echo "**************************************************" |
52 | } | 52 | } |
53 | 53 | ||
54 | DIST="$1" | 54 | DIST="$1" |
55 | while [ $# -gt 0 ]; do # Until you run out of parameters . . . | 55 | while [[ $# -gt 0 ]]; do # Until you run out of parameters . . . |
56 | case "$1" in | 56 | case "$1" in |
57 | --clean) | 57 | --clean) |
58 | cleanup | 58 | cleanup |
59 | exit | 59 | exit |
60 | ;; | 60 | ;; |
61 | --help) | 61 | --help) |
62 | echo "./compile.sh [--clean|--help]" | 62 | echo "./compile.sh [--clean|--help]" |
63 | exit | 63 | exit |
64 | ;; | 64 | ;; |
65 | esac | 65 | esac |
66 | shift # Check next set of parameters. | 66 | shift # Check next set of parameters. |
67 | done | 67 | done |
68 | 68 | ||
69 | cleanup | 69 | cleanup |
@@ -76,8 +76,8 @@ cleanup | |||
76 | #***************************************************************** | 76 | #***************************************************************** |
77 | print_title "${arr[1]}" | 77 | print_title "${arr[1]}" |
78 | echo "$DIST" | 78 | echo "$DIST" |
79 | tar -xJvf ../../$DIST.tar.xz | 79 | tar -xJvf ../../"$DIST.tar.xz" |
80 | mv $DIST firejail | 80 | mv "$DIST" firejail |
81 | 81 | ||
82 | cd firejail | 82 | cd firejail |
83 | ./configure --prefix=/usr --enable-fatal-warnings 2>&1 | tee ../output-configure | 83 | ./configure --prefix=/usr --enable-fatal-warnings 2>&1 | tee ../output-configure |
@@ -89,7 +89,6 @@ cp output-configure oc1 | |||
89 | cp output-make om1 | 89 | cp output-make om1 |
90 | rm output-configure output-make | 90 | rm output-configure output-make |
91 | 91 | ||
92 | |||
93 | #***************************************************************** | 92 | #***************************************************************** |
94 | # TEST 2 | 93 | # TEST 2 |
95 | #***************************************************************** | 94 | #***************************************************************** |
@@ -98,7 +97,7 @@ rm output-configure output-make | |||
98 | print_title "${arr[2]}" | 97 | print_title "${arr[2]}" |
99 | cd firejail | 98 | cd firejail |
100 | make distclean | 99 | make distclean |
101 | ./configure --prefix=/usr --disable-dbusproxy --enable-fatal-warnings 2>&1 | tee ../output-configure | 100 | ./configure --prefix=/usr --disable-dbusproxy --enable-fatal-warnings 2>&1 | tee ../output-configure |
102 | make -j4 2>&1 | tee ../output-make | 101 | make -j4 2>&1 | tee ../output-make |
103 | cd .. | 102 | cd .. |
104 | grep Warning output-configure output-make > ./report-test2 | 103 | grep Warning output-configure output-make > ./report-test2 |
@@ -115,7 +114,7 @@ rm output-configure output-make | |||
115 | print_title "${arr[3]}" | 114 | print_title "${arr[3]}" |
116 | cd firejail | 115 | cd firejail |
117 | make distclean | 116 | make distclean |
118 | ./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure | 117 | ./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure |
119 | make -j4 2>&1 | tee ../output-make | 118 | make -j4 2>&1 | tee ../output-make |
120 | cd .. | 119 | cd .. |
121 | grep Warning output-configure output-make > ./report-test3 | 120 | grep Warning output-configure output-make > ./report-test3 |
@@ -132,7 +131,7 @@ rm output-configure output-make | |||
132 | print_title "${arr[4]}" | 131 | print_title "${arr[4]}" |
133 | cd firejail | 132 | cd firejail |
134 | make distclean | 133 | make distclean |
135 | ./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure | 134 | ./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure |
136 | make -j4 2>&1 | tee ../output-make | 135 | make -j4 2>&1 | tee ../output-make |
137 | cd .. | 136 | cd .. |
138 | grep Warning output-configure output-make > ./report-test4 | 137 | grep Warning output-configure output-make > ./report-test4 |
@@ -149,7 +148,7 @@ rm output-configure output-make | |||
149 | print_title "${arr[5]}" | 148 | print_title "${arr[5]}" |
150 | cd firejail | 149 | cd firejail |
151 | make distclean | 150 | make distclean |
152 | ./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure | 151 | ./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure |
153 | make -j4 2>&1 | tee ../output-make | 152 | make -j4 2>&1 | tee ../output-make |
154 | cd .. | 153 | cd .. |
155 | grep Warning output-configure output-make > ./report-test5 | 154 | grep Warning output-configure output-make > ./report-test5 |
@@ -167,7 +166,7 @@ rm output-configure output-make | |||
167 | print_title "${arr[6]}" | 166 | print_title "${arr[6]}" |
168 | cd firejail | 167 | cd firejail |
169 | make distclean | 168 | make distclean |
170 | ./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure | 169 | ./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure |
171 | make -j4 2>&1 | tee ../output-make | 170 | make -j4 2>&1 | tee ../output-make |
172 | cd .. | 171 | cd .. |
173 | grep Warning output-configure output-make > ./report-test6 | 172 | grep Warning output-configure output-make > ./report-test6 |
@@ -184,7 +183,7 @@ rm output-configure output-make | |||
184 | print_title "${arr[7]}" | 183 | print_title "${arr[7]}" |
185 | cd firejail | 184 | cd firejail |
186 | make distclean | 185 | make distclean |
187 | ./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure | 186 | ./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure |
188 | make -j4 2>&1 | tee ../output-make | 187 | make -j4 2>&1 | tee ../output-make |
189 | cd .. | 188 | cd .. |
190 | grep Warning output-configure output-make > ./report-test7 | 189 | grep Warning output-configure output-make > ./report-test7 |
@@ -218,7 +217,7 @@ rm output-configure output-make | |||
218 | print_title "${arr[9]}" | 217 | print_title "${arr[9]}" |
219 | cd firejail | 218 | cd firejail |
220 | make distclean | 219 | make distclean |
221 | ./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure | 220 | ./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure |
222 | make -j4 2>&1 | tee ../output-make | 221 | make -j4 2>&1 | tee ../output-make |
223 | cd .. | 222 | cd .. |
224 | grep Warning output-configure output-make > ./report-test9 | 223 | grep Warning output-configure output-make > ./report-test9 |
@@ -235,7 +234,7 @@ rm output-configure output-make | |||
235 | print_title "${arr[10]}" | 234 | print_title "${arr[10]}" |
236 | cd firejail | 235 | cd firejail |
237 | make distclean | 236 | make distclean |
238 | ./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure | 237 | ./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure |
239 | make -j4 2>&1 | tee ../output-make | 238 | make -j4 2>&1 | tee ../output-make |
240 | cd .. | 239 | cd .. |
241 | grep Warning output-configure output-make > ./report-test10 | 240 | grep Warning output-configure output-make > ./report-test10 |
@@ -252,7 +251,7 @@ rm output-configure output-make | |||
252 | print_title "${arr[11]}" | 251 | print_title "${arr[11]}" |
253 | cd firejail | 252 | cd firejail |
254 | make distclean | 253 | make distclean |
255 | ./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure | 254 | ./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure |
256 | make -j4 2>&1 | tee ../output-make | 255 | make -j4 2>&1 | tee ../output-make |
257 | cd .. | 256 | cd .. |
258 | grep Warning output-configure output-make > ./report-test11 | 257 | grep Warning output-configure output-make > ./report-test11 |
@@ -269,7 +268,7 @@ rm output-configure output-make | |||
269 | print_title "${arr[12]}" | 268 | print_title "${arr[12]}" |
270 | cd firejail | 269 | cd firejail |
271 | make distclean | 270 | make distclean |
272 | ./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure | 271 | ./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure |
273 | make -j4 2>&1 | tee ../output-make | 272 | make -j4 2>&1 | tee ../output-make |
274 | cd .. | 273 | cd .. |
275 | grep Warning output-configure output-make > ./report-test12 | 274 | grep Warning output-configure output-make > ./report-test12 |
@@ -354,7 +353,7 @@ rm output-configure output-make | |||
354 | print_title "${arr[17]}" | 353 | print_title "${arr[17]}" |
355 | cd firejail | 354 | cd firejail |
356 | make distclean | 355 | make distclean |
357 | ./configure --prefix=/usr --disable-usertmpfs --enable-fatal-warnings 2>&1 | tee ../output-configure | 356 | ./configure --prefix=/usr --disable-usertmpfs --enable-fatal-warnings 2>&1 | tee ../output-configure |
358 | make -j4 2>&1 | tee ../output-make | 357 | make -j4 2>&1 | tee ../output-make |
359 | cd .. | 358 | cd .. |
360 | grep Warning output-configure output-make > ./report-test17 | 359 | grep Warning output-configure output-make > ./report-test17 |
@@ -410,23 +409,23 @@ echo "**********************************************************" | |||
410 | 409 | ||
411 | wc -l report-test* | 410 | wc -l report-test* |
412 | echo | 411 | echo |
413 | echo "Legend:" | 412 | echo "Legend:" |
414 | echo ${arr[1]} | 413 | echo "${arr[1]}" |
415 | echo ${arr[2]} | 414 | echo "${arr[2]}" |
416 | echo ${arr[3]} | 415 | echo "${arr[3]}" |
417 | echo ${arr[4]} | 416 | echo "${arr[4]}" |
418 | echo ${arr[5]} | 417 | echo "${arr[5]}" |
419 | echo ${arr[6]} | 418 | echo "${arr[6]}" |
420 | echo ${arr[7]} | 419 | echo "${arr[7]}" |
421 | echo ${arr[8]} | 420 | echo "${arr[8]}" |
422 | echo ${arr[9]} | 421 | echo "${arr[9]}" |
423 | echo ${arr[10]} | 422 | echo "${arr[10]}" |
424 | echo ${arr[11]} | 423 | echo "${arr[11]}" |
425 | echo ${arr[12]} | 424 | echo "${arr[12]}" |
426 | echo ${arr[13]} | 425 | echo "${arr[13]}" |
427 | echo ${arr[14]} | 426 | echo "${arr[14]}" |
428 | echo ${arr[15]} | 427 | echo "${arr[15]}" |
429 | echo ${arr[16]} | 428 | echo "${arr[16]}" |
430 | echo ${arr[17]} | 429 | echo "${arr[17]}" |
431 | echo ${arr[18]} | 430 | echo "${arr[18]}" |
432 | echo ${arr[19]} | 431 | echo "${arr[19]}" |
diff --git a/test/environment/environment.sh b/test/environment/environment.sh index da9c170b9..c88c91741 100755 --- a/test/environment/environment.sh +++ b/test/environment/environment.sh | |||
@@ -7,7 +7,6 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | |||
11 | echo "TESTING: timeout (test/environment/timeout.exp)" | 10 | echo "TESTING: timeout (test/environment/timeout.exp)" |
12 | ./timeout.exp | 11 | ./timeout.exp |
13 | 12 | ||
@@ -39,13 +38,12 @@ echo "TESTING: environment variables (test/environment/env.exp)" | |||
39 | echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" | 38 | echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" |
40 | ./firejail-in-firejail.exp | 39 | ./firejail-in-firejail.exp |
41 | 40 | ||
42 | which aplay 2>/dev/null | 41 | if command -v aplay && [[ $(aplay -l | grep -c "List of PLAYBACK") -gt 0 ]] |
43 | if [ "$?" -eq 0 ] && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ]; | ||
44 | then | 42 | then |
45 | echo "TESTING: sound (test/environment/sound.exp)" | 43 | echo "TESTING: sound (test/environment/sound.exp)" |
46 | ./sound.exp | 44 | ./sound.exp |
47 | else | 45 | else |
48 | echo "TESTING SKIP: no aplay or sound card found" | 46 | echo "TESTING SKIP: no aplay or sound card found" |
49 | fi | 47 | fi |
50 | 48 | ||
51 | echo "TESTING: nice (test/environment/nice.exp)" | 49 | echo "TESTING: nice (test/environment/nice.exp)" |
@@ -54,26 +52,24 @@ echo "TESTING: nice (test/environment/nice.exp)" | |||
54 | echo "TESTING: quiet (test/environment/quiet.exp)" | 52 | echo "TESTING: quiet (test/environment/quiet.exp)" |
55 | ./quiet.exp | 53 | ./quiet.exp |
56 | 54 | ||
57 | which strace 2>/dev/null | 55 | if command -v strace |
58 | if [ "$?" -eq 0 ]; | ||
59 | then | 56 | then |
60 | echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" | 57 | echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" |
61 | ./allow-debuggers.exp | 58 | ./allow-debuggers.exp |
62 | else | 59 | else |
63 | echo "TESTING SKIP: strace not found" | 60 | echo "TESTING SKIP: strace not found" |
64 | fi | 61 | fi |
65 | 62 | ||
66 | # to install ibus: | 63 | # to install ibus: |
67 | # $ sudo apt-get install ibus-table-array30 | 64 | # $ sudo apt-get install ibus-table-array30 |
68 | # $ ibus-setup | 65 | # $ ibus-setup |
69 | 66 | ||
70 | find ~/.config/ibus/bus | grep unix-0 | 67 | if find ~/.config/ibus/bus | grep unix-0 |
71 | if [ "$?" -eq 0 ]; | ||
72 | then | 68 | then |
73 | echo "TESTING: ibus (test/environment/ibus.exp)" | 69 | echo "TESTING: ibus (test/environment/ibus.exp)" |
74 | ./ibus.exp | 70 | ./ibus.exp |
75 | else | 71 | else |
76 | echo "TESTING SKIP: ibus not configured" | 72 | echo "TESTING SKIP: ibus not configured" |
77 | fi | 73 | fi |
78 | 74 | ||
79 | echo "TESTING: rlimit (test/environment/rlimit.exp)" | 75 | echo "TESTING: rlimit (test/environment/rlimit.exp)" |
diff --git a/test/environment/output.sh b/test/environment/output.sh index 329cb40c7..ba06f9184 100755 --- a/test/environment/output.sh +++ b/test/environment/output.sh | |||
@@ -5,8 +5,8 @@ | |||
5 | 5 | ||
6 | i="0" | 6 | i="0" |
7 | 7 | ||
8 | while [ $i -lt 150000 ] | 8 | while [[ $i -lt 150000 ]] |
9 | do | 9 | do |
10 | echo message number $i | 10 | echo "message number $i" |
11 | i=$[$i+1] | 11 | i=$((i+1)) |
12 | done | 12 | done |
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh index fca599889..72b87d14c 100755 --- a/test/fcopy/fcopy.sh +++ b/test/fcopy/fcopy.sh | |||
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | if [ -f /etc/debian_version ]; then | 10 | if [[ -f /etc/debian_version ]]; then |
11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") | 11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") |
12 | export PATH="$PATH:$libdir" | 12 | export PATH="$PATH:$libdir" |
13 | fi | 13 | fi |
@@ -29,4 +29,4 @@ echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" | |||
29 | ./dircopy.exp | 29 | ./dircopy.exp |
30 | 30 | ||
31 | rm -fr dest/* | 31 | rm -fr dest/* |
32 | rm -f src/dircopy.exp \ No newline at end of file | 32 | rm -f src/dircopy.exp |
diff --git a/test/features/test.sh b/test/features/test.sh index b507c6d37..44677aaa7 100755 --- a/test/features/test.sh +++ b/test/features/test.sh | |||
@@ -8,28 +8,25 @@ OVERLAY="overlay" | |||
8 | CHROOT="chroot" | 8 | CHROOT="chroot" |
9 | NETWORK="network" | 9 | NETWORK="network" |
10 | 10 | ||
11 | while [ $# -gt 0 ]; do # Until you run out of parameters . . . | 11 | while [[ $# -gt 0 ]]; do # Until you run out of parameters . . . |
12 | case "$1" in | 12 | case "$1" in |
13 | --nooverlay) | 13 | --nooverlay) |
14 | OVERLAY="none" | 14 | OVERLAY="none" |
15 | ;; | 15 | ;; |
16 | --nochroot) | 16 | --nochroot) |
17 | CHROOT="none" | 17 | CHROOT="none" |
18 | ;; | 18 | ;; |
19 | --nonetwork) | 19 | --nonetwork) |
20 | NETWORK="none" | 20 | NETWORK="none" |
21 | ;; | 21 | ;; |
22 | --help) | 22 | --help) |
23 | echo "./test.sh [--nooverlay|--nochroot|--nonetwork|--help] | grep TESTING" | 23 | echo "./test.sh [--nooverlay|--nochroot|--nonetwork|--help] | grep TESTING" |
24 | exit | 24 | exit |
25 | ;; | 25 | ;; |
26 | esac | 26 | esac |
27 | shift # Check next set of parameters. | 27 | shift # Check next set of parameters. |
28 | done | 28 | done |
29 | 29 | ||
30 | |||
31 | |||
32 | |||
33 | # | 30 | # |
34 | # Feature testing | 31 | # Feature testing |
35 | # | 32 | # |
@@ -38,85 +35,85 @@ done | |||
38 | # Default features | 35 | # Default features |
39 | #################### | 36 | #################### |
40 | echo "TESTING: 1.1 disable /boot" | 37 | echo "TESTING: 1.1 disable /boot" |
41 | ./1.1.exp $OVERLAY $CHROOT | 38 | ./1.1.exp "$OVERLAY" "$CHROOT" |
42 | 39 | ||
43 | echo "TESTING: 1.2 new /proc" | 40 | echo "TESTING: 1.2 new /proc" |
44 | ./1.2.exp $OVERLAY $CHROOT | 41 | ./1.2.exp "$OVERLAY" "$CHROOT" |
45 | 42 | ||
46 | echo "TESTING: 1.4 mask other users" | 43 | echo "TESTING: 1.4 mask other users" |
47 | ./1.4.exp $OVERLAY $CHROOT | 44 | ./1.4.exp "$OVERLAY" "$CHROOT" |
48 | 45 | ||
49 | echo "TESTING: 1.5 PID namespace" | 46 | echo "TESTING: 1.5 PID namespace" |
50 | ./1.5.exp $OVERLAY $CHROOT | 47 | ./1.5.exp "$OVERLAY" "$CHROOT" |
51 | 48 | ||
52 | echo "TESTING: 1.6 new /var/log" | 49 | echo "TESTING: 1.6 new /var/log" |
53 | ./1.6.exp $OVERLAY $CHROOT | 50 | ./1.6.exp "$OVERLAY" "$CHROOT" |
54 | 51 | ||
55 | echo "TESTING: 1.7 new /var/tmp" | 52 | echo "TESTING: 1.7 new /var/tmp" |
56 | ./1.7.exp $OVERLAY $CHROOT | 53 | ./1.7.exp "$OVERLAY" "$CHROOT" |
57 | 54 | ||
58 | echo "TESTING: 1.8 disable firejail config and run time information" | 55 | echo "TESTING: 1.8 disable firejail config and run time information" |
59 | ./1.8.exp $OVERLAY $CHROOT | 56 | ./1.8.exp "$OVERLAY" "$CHROOT" |
60 | 57 | ||
61 | echo "TESTING: 1.10 disable /selinux" | 58 | echo "TESTING: 1.10 disable /selinux" |
62 | ./1.10.exp $OVERLAY $CHROOT | 59 | ./1.10.exp "$OVERLAY" "$CHROOT" |
63 | 60 | ||
64 | #################### | 61 | #################### |
65 | # networking features | 62 | # networking features |
66 | #################### | 63 | #################### |
67 | if [ $NETWORK == "network" ] | 64 | if [[ $NETWORK == "network" ]] |
68 | then | 65 | then |
69 | echo "TESTING: 2.1 hostname" | 66 | echo "TESTING: 2.1 hostname" |
70 | ./2.1.exp $OVERLAY $CHROOT | 67 | ./2.1.exp "$OVERLAY" "$CHROOT" |
71 | 68 | ||
72 | echo "TESTING: 2.2 DNS" | 69 | echo "TESTING: 2.2 DNS" |
73 | ./2.2.exp $OVERLAY $CHROOT | 70 | ./2.2.exp "$OVERLAY" "$CHROOT" |
74 | 71 | ||
75 | echo "TESTING: 2.3 mac-vlan" | 72 | echo "TESTING: 2.3 mac-vlan" |
76 | ./2.3.exp $OVERLAY $CHROOT | 73 | ./2.3.exp "$OVERLAY" "$CHROOT" |
77 | 74 | ||
78 | echo "TESTING: 2.4 bridge" | 75 | echo "TESTING: 2.4 bridge" |
79 | ./2.4.exp $OVERLAY $CHROOT | 76 | ./2.4.exp "$OVERLAY" "$CHROOT" |
80 | 77 | ||
81 | echo "TESTING: 2.5 interface" | 78 | echo "TESTING: 2.5 interface" |
82 | ./2.5.exp $OVERLAY $CHROOT | 79 | ./2.5.exp "$OVERLAY" "$CHROOT" |
83 | 80 | ||
84 | echo "TESTING: 2.6 Default gateway" | 81 | echo "TESTING: 2.6 Default gateway" |
85 | ./2.6.exp $OVERLAY $CHROOT | 82 | ./2.6.exp "$OVERLAY" "$CHROOT" |
86 | fi | 83 | fi |
87 | 84 | ||
88 | #################### | 85 | #################### |
89 | # filesystem features | 86 | # filesystem features |
90 | #################### | 87 | #################### |
91 | echo "TESTING: 3.1 private (fails on OpenSUSE)" | 88 | echo "TESTING: 3.1 private (fails on OpenSUSE)" |
92 | ./3.1.exp $OVERLAY $CHROOT | 89 | ./3.1.exp "$OVERLAY" "$CHROOT" |
93 | 90 | ||
94 | echo "TESTING: 3.2 read-only" | 91 | echo "TESTING: 3.2 read-only" |
95 | ./3.2.exp $OVERLAY $CHROOT | 92 | ./3.2.exp "$OVERLAY" "$CHROOT" |
96 | 93 | ||
97 | echo "TESTING: 3.3 blacklist" | 94 | echo "TESTING: 3.3 blacklist" |
98 | ./3.3.exp $OVERLAY $CHROOT | 95 | ./3.3.exp "$OVERLAY" "$CHROOT" |
99 | 96 | ||
100 | echo "TESTING: 3.4 whitelist home (fails on OpenSUSE)" | 97 | echo "TESTING: 3.4 whitelist home (fails on OpenSUSE)" |
101 | ./3.4.exp $OVERLAY $CHROOT | 98 | ./3.4.exp "$OVERLAY" "$CHROOT" |
102 | 99 | ||
103 | echo "TESTING: 3.5 private-dev" | 100 | echo "TESTING: 3.5 private-dev" |
104 | ./3.5.exp $OVERLAY $CHROOT | 101 | ./3.5.exp "$OVERLAY" "$CHROOT" |
105 | 102 | ||
106 | echo "TESTING: 3.6 private-etc" | 103 | echo "TESTING: 3.6 private-etc" |
107 | ./3.6.exp notworking $CHROOT | 104 | ./3.6.exp notworking "$CHROOT" |
108 | 105 | ||
109 | echo "TESTING: 3.7 private-tmp" | 106 | echo "TESTING: 3.7 private-tmp" |
110 | ./3.7.exp $OVERLAY $CHROOT | 107 | ./3.7.exp "$OVERLAY" "$CHROOT" |
111 | 108 | ||
112 | echo "TESTING: 3.8 private-bin" | 109 | echo "TESTING: 3.8 private-bin" |
113 | ./3.8.exp notworking notworking | 110 | ./3.8.exp notworking notworking |
114 | 111 | ||
115 | echo "TESTING: 3.9 whitelist dev" | 112 | echo "TESTING: 3.9 whitelist dev" |
116 | ./3.9.exp $OVERLAY $CHROOT | 113 | ./3.9.exp "$OVERLAY" "$CHROOT" |
117 | 114 | ||
118 | echo "TESTING: 3.10 whitelist tmp" | 115 | echo "TESTING: 3.10 whitelist tmp" |
119 | ./3.10.exp $OVERLAY $CHROOT | 116 | ./3.10.exp "$OVERLAY" "$CHROOT" |
120 | 117 | ||
121 | echo "TESTING: 3.11 mkdir" | 118 | echo "TESTING: 3.11 mkdir" |
122 | ./3.11.exp $OVERLAY $CHROOT | 119 | ./3.11.exp "$OVERLAY" "$CHROOT" |
diff --git a/test/filters/filters.sh b/test/filters/filters.sh index 04d7080d6..3b4a6b492 100755 --- a/test/filters/filters.sh +++ b/test/filters/filters.sh | |||
@@ -7,37 +7,37 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | if [ -f /etc/debian_version ]; then | 10 | if [[ -f /etc/debian_version ]]; then |
11 | libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") | 11 | libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") |
12 | export PATH="$PATH:$libdir" | 12 | export PATH="$PATH:$libdir" |
13 | fi | 13 | fi |
14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" | 14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" |
15 | 15 | ||
16 | if [ -f /sys/kernel/security/apparmor/profiles ]; then | 16 | if [[ -f /sys/kernel/security/apparmor/profiles ]]; then |
17 | echo "TESTING: apparmor (test/filters/apparmor.exp)" | 17 | echo "TESTING: apparmor (test/filters/apparmor.exp)" |
18 | ./apparmor.exp | 18 | ./apparmor.exp |
19 | else | 19 | else |
20 | echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" | 20 | echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" |
21 | fi | 21 | fi |
22 | 22 | ||
23 | if [ "$(uname -m)" = "x86_64" ]; then | 23 | if [[ $(uname -m) == "x86_64" ]]; then |
24 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" | 24 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" |
25 | ./memwrexe.exp | 25 | ./memwrexe.exp |
26 | elif [ "$(uname -m)" = "i686" ]; then | 26 | elif [[ $(uname -m) == "i686" ]]; then |
27 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)" | 27 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)" |
28 | ./memwrexe-32.exp | 28 | ./memwrexe-32.exp |
29 | else | 29 | else |
30 | echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686." | 30 | echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686." |
31 | fi | 31 | fi |
32 | 32 | ||
33 | echo "TESTING: debug options (test/filters/debug.exp)" | 33 | echo "TESTING: debug options (test/filters/debug.exp)" |
34 | ./debug.exp | 34 | ./debug.exp |
35 | 35 | ||
36 | if [ "$(uname -m)" = "x86_64" ]; then | 36 | if [[ $(uname -m) == "x86_64" ]]; then |
37 | echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)" | 37 | echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)" |
38 | ./seccomp-run-files.exp | 38 | ./seccomp-run-files.exp |
39 | else | 39 | else |
40 | echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64." | 40 | echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64." |
41 | fi | 41 | fi |
42 | 42 | ||
43 | echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" | 43 | echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" |
@@ -61,33 +61,33 @@ echo "TESTING: capabilities join (test/filters/caps-join.exp)" | |||
61 | ./caps-join.exp | 61 | ./caps-join.exp |
62 | 62 | ||
63 | rm -f seccomp-test-file | 63 | rm -f seccomp-test-file |
64 | if [ "$(uname -m)" = "x86_64" ]; then | 64 | if [[ $(uname -m) == "x86_64" ]]; then |
65 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" | 65 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" |
66 | ./fseccomp.exp | 66 | ./fseccomp.exp |
67 | else | 67 | else |
68 | echo "TESTING SKIP: fseccomp test implemented only for x86_64" | 68 | echo "TESTING SKIP: fseccomp test implemented only for x86_64" |
69 | fi | 69 | fi |
70 | rm -f seccomp-test-file | 70 | rm -f seccomp-test-file |
71 | 71 | ||
72 | 72 | ||
73 | if [ "$(uname -m)" = "x86_64" ]; then | 73 | if [[ $(uname -m) == "x86_64" ]]; then |
74 | echo "TESTING: protocol (test/filters/protocol.exp)" | 74 | echo "TESTING: protocol (test/filters/protocol.exp)" |
75 | ./protocol.exp | 75 | ./protocol.exp |
76 | else | 76 | else |
77 | echo "TESTING SKIP: protocol, running only on x86_64" | 77 | echo "TESTING SKIP: protocol, running only on x86_64" |
78 | fi | 78 | fi |
79 | 79 | ||
80 | echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" | 80 | echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" |
81 | ./seccomp-bad-empty.exp | 81 | ./seccomp-bad-empty.exp |
82 | 82 | ||
83 | if [ "$(uname -m)" = "x86_64" ]; then | 83 | if [[ $(uname -m) == "x86_64" ]]; then |
84 | echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" | 84 | echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" |
85 | ./seccomp-debug.exp | 85 | ./seccomp-debug.exp |
86 | elif [ "$(uname -m)" = "i686" ]; then | 86 | elif [[ $(uname -m) == "i686" ]]; then |
87 | echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)" | 87 | echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)" |
88 | ./seccomp-debug-32.exp | 88 | ./seccomp-debug-32.exp |
89 | else | 89 | else |
90 | echo "TESTING SKIP: protocol, running only on x86_64 and i686" | 90 | echo "TESTING SKIP: protocol, running only on x86_64 and i686" |
91 | fi | 91 | fi |
92 | 92 | ||
93 | echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" | 93 | echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" |
@@ -96,12 +96,11 @@ echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" | |||
96 | echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" | 96 | echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" |
97 | ./seccomp-su.exp | 97 | ./seccomp-su.exp |
98 | 98 | ||
99 | which strace 2>/dev/null | 99 | if command -v strace; then |
100 | if [ $? -eq 0 ]; then | 100 | echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" |
101 | echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" | 101 | ./seccomp-ptrace.exp |
102 | ./seccomp-ptrace.exp | ||
103 | else | 102 | else |
104 | echo "TESTING SKIP: ptrace, strace not found" | 103 | echo "TESTING SKIP: ptrace, strace not found" |
105 | fi | 104 | fi |
106 | 105 | ||
107 | echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)" | 106 | echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)" |
@@ -115,16 +114,16 @@ echo "TESTING: seccomp chmod profile - seccomp lists (test/filters/seccomp-chmod | |||
115 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" | 114 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" |
116 | ./seccomp-empty.exp | 115 | ./seccomp-empty.exp |
117 | 116 | ||
118 | if [ "$(uname -m)" = "x86_64" ]; then | 117 | if [[ $(uname -m) == "x86_64" ]]; then |
119 | echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" | 118 | echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" |
120 | ./seccomp-numeric.exp | 119 | ./seccomp-numeric.exp |
121 | else | 120 | else |
122 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" | 121 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" |
123 | fi | 122 | fi |
124 | 123 | ||
125 | if [ "$(uname -m)" = "x86_64" ]; then | 124 | if [[ $(uname -m) == "x86_64" ]]; then |
126 | echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" | 125 | echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" |
127 | ./seccomp-join.exp | 126 | ./seccomp-join.exp |
128 | else | 127 | else |
129 | echo "TESTING SKIP: seccomp join test implemented only for x86_64" | 128 | echo "TESTING SKIP: seccomp join test implemented only for x86_64" |
130 | fi | 129 | fi |
diff --git a/test/fnetfilter/fnetfilter.sh b/test/fnetfilter/fnetfilter.sh index 9ad822753..52f921232 100755 --- a/test/fnetfilter/fnetfilter.sh +++ b/test/fnetfilter/fnetfilter.sh | |||
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | if [ -f /etc/debian_version ]; then | 10 | if [[ -f /etc/debian_version ]]; then |
11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") | 11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") |
12 | export PATH="$PATH:$libdir" | 12 | export PATH="$PATH:$libdir" |
13 | fi | 13 | fi |
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 36ff30934..697c86d3d 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -34,7 +34,7 @@ rm -f ~/_firejail_test_dir | |||
34 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" | 34 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" |
35 | ./sys_fs.exp | 35 | ./sys_fs.exp |
36 | 36 | ||
37 | if [ -c /dev/kmsg ]; then | 37 | if [[ -c /dev/kmsg ]]; then |
38 | echo "TESTING: kmsg access (test/fs/kmsg.exp)" | 38 | echo "TESTING: kmsg access (test/fs/kmsg.exp)" |
39 | ./kmsg.exp | 39 | ./kmsg.exp |
40 | else | 40 | else |
@@ -45,27 +45,27 @@ echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)" | |||
45 | ./fs_var_tmp.exp | 45 | ./fs_var_tmp.exp |
46 | rm -f /var/tmp/_firejail_test_file | 46 | rm -f /var/tmp/_firejail_test_file |
47 | 47 | ||
48 | if [ "$(uname -m)" = "x86_64" ]; then | 48 | if [[ $(uname -m) == "x86_64" ]]; then |
49 | fjconfig=/etc/firejail/firejail.config | 49 | fjconfig=/etc/firejail/firejail.config |
50 | printf 'private-lib yes\n' | sudo tee -a "$fjconfig" >/dev/null | 50 | printf 'private-lib yes\n' | sudo tee -a "$fjconfig" >/dev/null |
51 | echo "TESTING: private-lib (test/fs/private-lib.exp)" | 51 | echo "TESTING: private-lib (test/fs/private-lib.exp)" |
52 | ./private-lib.exp | 52 | ./private-lib.exp |
53 | printf '%s\n' "$(sed '/^private-lib yes$/d' "$fjconfig")" | | 53 | printf '%s\n' "$(sed '/^private-lib yes$/d' "$fjconfig")" | |
54 | sudo tee "$fjconfig" >/dev/null | 54 | sudo tee "$fjconfig" >/dev/null |
55 | else | 55 | else |
56 | echo "TESTING SKIP: private-lib test implemented only for x86_64." | 56 | echo "TESTING SKIP: private-lib test implemented only for x86_64." |
57 | fi | 57 | fi |
58 | 58 | ||
59 | echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" | 59 | echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" |
60 | ./fs_var_lock.exp | 60 | ./fs_var_lock.exp |
61 | rm -f /var/lock/_firejail_test_file | 61 | rm -f /var/lock/_firejail_test_file |
62 | 62 | ||
63 | if [ -w /dev/shm ]; then | 63 | if [[ -w /dev/shm ]]; then |
64 | echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)" | 64 | echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)" |
65 | ./fs_dev_shm.exp | 65 | ./fs_dev_shm.exp |
66 | rm -f /dev/shm/_firejail_test_file | 66 | rm -f /dev/shm/_firejail_test_file |
67 | else | 67 | else |
68 | echo "TESTING SKIP: /dev/shm not writable" | 68 | echo "TESTING SKIP: /dev/shm not writable" |
69 | fi | 69 | fi |
70 | 70 | ||
71 | echo "TESTING: private (test/fs/private.exp)" | 71 | echo "TESTING: private (test/fs/private.exp)" |
diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh index 490b180e1..a0519d1ad 100755 --- a/test/overlay/overlay.sh +++ b/test/overlay/overlay.sh | |||
@@ -22,8 +22,7 @@ rm -fr ~/_firejail_test_* | |||
22 | ./fs-tmpfs.exp | 22 | ./fs-tmpfs.exp |
23 | rm -fr ~/_firejail_test_* | 23 | rm -fr ~/_firejail_test_* |
24 | 24 | ||
25 | which firefox 2>/dev/null | 25 | if command -v firefox |
26 | if [ "$?" -eq 0 ]; | ||
27 | then | 26 | then |
28 | echo "TESTING: overlay firefox" | 27 | echo "TESTING: overlay firefox" |
29 | ./firefox.exp | 28 | ./firefox.exp |
@@ -31,8 +30,7 @@ else | |||
31 | echo "TESTING SKIP: firefox not found" | 30 | echo "TESTING SKIP: firefox not found" |
32 | fi | 31 | fi |
33 | 32 | ||
34 | which firefox 2>/dev/null | 33 | if command -v firefox |
35 | if [ "$?" -eq 0 ]; | ||
36 | then | 34 | then |
37 | echo "TESTING: overlay firefox x11 xorg" | 35 | echo "TESTING: overlay firefox x11 xorg" |
38 | ./firefox.exp | 36 | ./firefox.exp |
@@ -40,26 +38,22 @@ else | |||
40 | echo "TESTING SKIP: firefox not found" | 38 | echo "TESTING SKIP: firefox not found" |
41 | fi | 39 | fi |
42 | 40 | ||
43 | |||
44 | # check xpra/xephyr | 41 | # check xpra/xephyr |
45 | which xpra 2>/dev/null | 42 | if command -v xpra |
46 | if [ "$?" -eq 0 ]; | ||
47 | then | 43 | then |
48 | echo "xpra found" | 44 | echo "xpra found" |
49 | else | 45 | else |
50 | echo "xpra not found" | 46 | echo "xpra not found" |
51 | which Xephyr 2>/dev/null | 47 | if command -v Xephyr |
52 | if [ "$?" -eq 0 ]; | ||
53 | then | 48 | then |
54 | echo "Xephyr found" | 49 | echo "Xephyr found" |
55 | else | 50 | else |
56 | echo "TESTING SKIP: xpra and/or Xephyr not found" | 51 | echo "TESTING SKIP: xpra and/or Xephyr not found" |
57 | exit | 52 | exit |
58 | fi | 53 | fi |
59 | fi | 54 | fi |
60 | 55 | ||
61 | which firefox 2>/dev/null | 56 | if command -v firefox |
62 | if [ "$?" -eq 0 ]; | ||
63 | then | 57 | then |
64 | echo "TESTING: overlay firefox x11" | 58 | echo "TESTING: overlay firefox x11" |
65 | ./firefox-x11.exp | 59 | ./firefox-x11.exp |
diff --git a/test/private-lib/private-lib.sh b/test/private-lib/private-lib.sh index d168c2b1b..6b7d433c8 100755 --- a/test/private-lib/private-lib.sh +++ b/test/private-lib/private-lib.sh | |||
@@ -7,12 +7,10 @@ export MALLOC_CHECK_=3g | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | LIST="gnome-logs gnome-system-log gnome-nettool pavucontrol dig evince whois galculator gnome-calculator gedit leafpad mousepad pluma transmission-gtk xcalc atril gpicview eom eog" | 10 | apps=(gnome-logs gnome-system-log gnome-nettool pavucontrol dig evince whois galculator gnome-calculator gedit leafpad mousepad pluma transmission-gtk xcalc atril gpicview eom eog) |
11 | 11 | ||
12 | 12 | for app in "${apps[@]}"; do | |
13 | for app in $LIST; do | 13 | if command -v "$app" |
14 | which $app 2>/dev/null | ||
15 | if [ "$?" -eq 0 ]; | ||
16 | then | 14 | then |
17 | echo "TESTING: private-lib $app" | 15 | echo "TESTING: private-lib $app" |
18 | ./$app.exp | 16 | ./$app.exp |
diff --git a/test/profiles/all-profiles.sh b/test/profiles/all-profiles.sh index cc17b6b00..a550afe23 100755 --- a/test/profiles/all-profiles.sh +++ b/test/profiles/all-profiles.sh | |||
@@ -37,11 +37,11 @@ echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)" | |||
37 | echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" | 37 | echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" |
38 | ./profile_noperm.exp | 38 | ./profile_noperm.exp |
39 | 39 | ||
40 | PROFILES=`ls /etc/firejail/*.profile` | 40 | profiles=( /etc/firejail/*.profile ) |
41 | echo "TESTING: default profiles installed in /etc" | 41 | echo "TESTING: default profiles installed in /etc" |
42 | 42 | ||
43 | for PROFILE in $PROFILES | 43 | for profile in "${profiles[@]}" |
44 | do | 44 | do |
45 | echo "TESTING: $PROFILE" | 45 | echo "TESTING: $profile" |
46 | ./test-profile.exp $PROFILE | 46 | ./test-profile.exp "$profile" |
47 | done | 47 | done |
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh index 8808bc9d2..90c88aaf5 100755 --- a/test/profiles/profiles.sh +++ b/test/profiles/profiles.sh | |||
@@ -37,11 +37,11 @@ echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)" | |||
37 | echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" | 37 | echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" |
38 | ./profile_noperm.exp | 38 | ./profile_noperm.exp |
39 | 39 | ||
40 | PROFILES=`ls /etc/firejail/transmission*.profile /etc/firejail/fi*.profile /etc/firejail/fl*.profile /etc/firejail/free*.profile` | 40 | profiles=( /etc/firejail/transmission*.profile /etc/firejail/fi*.profile /etc/firejail/fl*.profile /etc/firejail/free*.profile ) |
41 | echo "TESTING: small number of default profiles installed in /etc" | 41 | echo "TESTING: small number of default profiles installed in /etc" |
42 | 42 | ||
43 | for PROFILE in $PROFILES | 43 | for profile in "${profiles[@]}" |
44 | do | 44 | do |
45 | echo "TESTING: $PROFILE" | 45 | echo "TESTING: $profile" |
46 | ./test-profile.exp $PROFILE | 46 | ./test-profile.exp "$profile" |
47 | done | 47 | done |
diff --git a/test/root/root.sh b/test/root/root.sh index e8c0ec1ac..a39525b6e 100755 --- a/test/root/root.sh +++ b/test/root/root.sh | |||
@@ -11,8 +11,7 @@ export LC_ALL=C | |||
11 | #******************************** | 11 | #******************************** |
12 | # firecfg | 12 | # firecfg |
13 | #******************************** | 13 | #******************************** |
14 | which less 2>/dev/null | 14 | if command -v less |
15 | if [ "$?" -eq 0 ]; | ||
16 | then | 15 | then |
17 | echo "TESTING: firecfg (test/root/firecfg.exp)" | 16 | echo "TESTING: firecfg (test/root/firecfg.exp)" |
18 | mv /home/netblue/.local/share/applications /home/netblue/.local/share/applications-store | 17 | mv /home/netblue/.local/share/applications /home/netblue/.local/share/applications-store |
@@ -25,24 +24,24 @@ fi | |||
25 | #******************************** | 24 | #******************************** |
26 | # servers | 25 | # servers |
27 | #******************************** | 26 | #******************************** |
28 | if [ -f /etc/init.d/snmpd ] | 27 | if [[ -f /etc/init.d/snmpd ]] |
29 | then | 28 | then |
30 | echo "TESTING: snmpd (test/root/snmpd.exp)" | 29 | echo "TESTING: snmpd (test/root/snmpd.exp)" |
31 | ./snmpd.exp | 30 | ./snmpd.exp |
32 | else | 31 | else |
33 | echo "TESTING SKIP: snmpd not found" | 32 | echo "TESTING SKIP: snmpd not found" |
34 | fi | 33 | fi |
35 | 34 | ||
36 | 35 | ||
37 | if [ -f /etc/init.d/apache2 ] | 36 | if [[ -f /etc/init.d/apache2 ]] |
38 | then | 37 | then |
39 | echo "TESTING: apache2 (test/root/apache2.exp)" | 38 | echo "TESTING: apache2 (test/root/apache2.exp)" |
40 | ./apache2.exp | 39 | ./apache2.exp |
41 | else | 40 | else |
42 | echo "TESTING SKIP: apache2 not found" | 41 | echo "TESTING SKIP: apache2 not found" |
43 | fi | 42 | fi |
44 | 43 | ||
45 | if [ -f /etc/init.d/isc-dhcp-server ] | 44 | if [[ -f /etc/init.d/isc-dhcp-server ]] |
46 | then | 45 | then |
47 | echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)" | 46 | echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)" |
48 | ./isc-dhcp.exp | 47 | ./isc-dhcp.exp |
@@ -50,20 +49,20 @@ else | |||
50 | echo "TESTING SKIP: isc dhcp server not found" | 49 | echo "TESTING SKIP: isc dhcp server not found" |
51 | fi | 50 | fi |
52 | 51 | ||
53 | if [ -f /etc/init.d/unbound ] | 52 | if [[ -f /etc/init.d/unbound ]] |
54 | then | 53 | then |
55 | echo "TESTING: unbound (test/root/unbound.exp)" | 54 | echo "TESTING: unbound (test/root/unbound.exp)" |
56 | ./unbound.exp | 55 | ./unbound.exp |
57 | else | 56 | else |
58 | echo "TESTING SKIP: unbound not found" | 57 | echo "TESTING SKIP: unbound not found" |
59 | fi | 58 | fi |
60 | 59 | ||
61 | if [ -f /etc/init.d/nginx ] | 60 | if [[ -f /etc/init.d/nginx ]] |
62 | then | 61 | then |
63 | echo "TESTING: nginx (test/root/nginx.exp)" | 62 | echo "TESTING: nginx (test/root/nginx.exp)" |
64 | ./nginx.exp | 63 | ./nginx.exp |
65 | else | 64 | else |
66 | echo "TESTING SKIP: nginx not found" | 65 | echo "TESTING SKIP: nginx not found" |
67 | fi | 66 | fi |
68 | 67 | ||
69 | #******************************** | 68 | #******************************** |
diff --git a/test/stress/stress.sh b/test/stress/stress.sh index 675cb0614..2b4d8147d 100755 --- a/test/stress/stress.sh +++ b/test/stress/stress.sh | |||
@@ -14,7 +14,7 @@ mkdir ~/fj-stress-test | |||
14 | rm blacklist.profile | 14 | rm blacklist.profile |
15 | rm noblacklist.profile | 15 | rm noblacklist.profile |
16 | rm env.profile | 16 | rm env.profile |
17 | for i in `seq 1 100`; | 17 | for i in {1..100} |
18 | do | 18 | do |
19 | echo "hello" > ~/fj-stress-test/testfile$i | 19 | echo "hello" > ~/fj-stress-test/testfile$i |
20 | echo "blacklist ~/fj-stress-test/testfile$i" >> blacklist.profile | 20 | echo "blacklist ~/fj-stress-test/testfile$i" >> blacklist.profile |
diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh index a903c7c6b..bfe723047 100755 --- a/test/sysutils/sysutils.sh +++ b/test/sysutils/sysutils.sh | |||
@@ -7,8 +7,7 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | which cpio 2>/dev/null | 10 | if command -v cpio |
11 | if [ "$?" -eq 0 ]; | ||
12 | then | 11 | then |
13 | echo "TESTING: cpio" | 12 | echo "TESTING: cpio" |
14 | ./cpio.exp | 13 | ./cpio.exp |
@@ -16,8 +15,7 @@ else | |||
16 | echo "TESTING SKIP: cpio not found" | 15 | echo "TESTING SKIP: cpio not found" |
17 | fi | 16 | fi |
18 | 17 | ||
19 | #which strings | 18 | #if command -v strings |
20 | #if [ "$?" -eq 0 ]; | ||
21 | #then | 19 | #then |
22 | # echo "TESTING: strings" | 20 | # echo "TESTING: strings" |
23 | # ./strings.exp | 21 | # ./strings.exp |
@@ -25,8 +23,7 @@ fi | |||
25 | # echo "TESTING SKIP: strings not found" | 23 | # echo "TESTING SKIP: strings not found" |
26 | #fi | 24 | #fi |
27 | 25 | ||
28 | which gzip 2>/dev/null | 26 | if command -v gzip |
29 | if [ "$?" -eq 0 ]; | ||
30 | then | 27 | then |
31 | echo "TESTING: gzip" | 28 | echo "TESTING: gzip" |
32 | ./gzip.exp | 29 | ./gzip.exp |
@@ -34,8 +31,7 @@ else | |||
34 | echo "TESTING SKIP: gzip not found" | 31 | echo "TESTING SKIP: gzip not found" |
35 | fi | 32 | fi |
36 | 33 | ||
37 | which xzdec 2>/dev/null | 34 | if command -v xzdec |
38 | if [ "$?" -eq 0 ]; | ||
39 | then | 35 | then |
40 | echo "TESTING: xzdec" | 36 | echo "TESTING: xzdec" |
41 | ./xzdec.exp | 37 | ./xzdec.exp |
@@ -43,8 +39,7 @@ else | |||
43 | echo "TESTING SKIP: xzdec not found" | 39 | echo "TESTING SKIP: xzdec not found" |
44 | fi | 40 | fi |
45 | 41 | ||
46 | which xz 2>/dev/null | 42 | if command -v xz |
47 | if [ "$?" -eq 0 ]; | ||
48 | then | 43 | then |
49 | echo "TESTING: xz" | 44 | echo "TESTING: xz" |
50 | ./xz.exp | 45 | ./xz.exp |
@@ -52,8 +47,7 @@ else | |||
52 | echo "TESTING SKIP: xz not found" | 47 | echo "TESTING SKIP: xz not found" |
53 | fi | 48 | fi |
54 | 49 | ||
55 | which less 2>/dev/null | 50 | if command -v less |
56 | if [ "$?" -eq 0 ]; | ||
57 | then | 51 | then |
58 | echo "TESTING: less" | 52 | echo "TESTING: less" |
59 | ./less.exp | 53 | ./less.exp |
@@ -61,8 +55,7 @@ else | |||
61 | echo "TESTING SKIP: less not found" | 55 | echo "TESTING SKIP: less not found" |
62 | fi | 56 | fi |
63 | 57 | ||
64 | which file 2>/dev/null | 58 | if command -v file |
65 | if [ "$?" -eq 0 ]; | ||
66 | then | 59 | then |
67 | echo "TESTING: file" | 60 | echo "TESTING: file" |
68 | ./file.exp | 61 | ./file.exp |
@@ -70,8 +63,7 @@ else | |||
70 | echo "TESTING SKIP: file not found" | 63 | echo "TESTING SKIP: file not found" |
71 | fi | 64 | fi |
72 | 65 | ||
73 | which tar 2>/dev/null | 66 | if command -v tar |
74 | if [ "$?" -eq 0 ]; | ||
75 | then | 67 | then |
76 | echo "TESTING: tar" | 68 | echo "TESTING: tar" |
77 | ./tar.exp | 69 | ./tar.exp |
@@ -79,8 +71,7 @@ else | |||
79 | echo "TESTING SKIP: tar not found" | 71 | echo "TESTING SKIP: tar not found" |
80 | fi | 72 | fi |
81 | 73 | ||
82 | which ping 2>/dev/null | 74 | if command -v ping |
83 | if [ "$?" -eq 0 ]; | ||
84 | then | 75 | then |
85 | echo "TESTING: ping" | 76 | echo "TESTING: ping" |
86 | ./ping.exp | 77 | ./ping.exp |
diff --git a/test/utils/catchsignal.sh b/test/utils/catchsignal.sh index 117179143..cef00b2a5 100755 --- a/test/utils/catchsignal.sh +++ b/test/utils/catchsignal.sh | |||
@@ -4,20 +4,20 @@ | |||
4 | # License GPL v2 | 4 | # License GPL v2 |
5 | 5 | ||
6 | _term() { | 6 | _term() { |
7 | echo "Caught Signal" | 7 | echo "Caught Signal" |
8 | echo 1 | 8 | echo 1 |
9 | sleep 1 | 9 | sleep 1 |
10 | echo 2 | 10 | echo 2 |
11 | sleep 1 | 11 | sleep 1 |
12 | echo 3 | 12 | echo 3 |
13 | sleep 1 | 13 | sleep 1 |
14 | echo 4 | 14 | echo 4 |
15 | sleep 1 | 15 | sleep 1 |
16 | echo 5 | 16 | echo 5 |
17 | sleep 1 | 17 | sleep 1 |
18 | 18 | ||
19 | kill $pid | 19 | kill $pid |
20 | exit | 20 | exit |
21 | } | 21 | } |
22 | 22 | ||
23 | trap _term SIGTERM | 23 | trap _term SIGTERM |
diff --git a/test/utils/catchsignal2.sh b/test/utils/catchsignal2.sh index 1bd7852cd..21f299430 100755 --- a/test/utils/catchsignal2.sh +++ b/test/utils/catchsignal2.sh | |||
@@ -4,42 +4,42 @@ | |||
4 | # License GPL v2 | 4 | # License GPL v2 |
5 | 5 | ||
6 | _term() { | 6 | _term() { |
7 | echo "Caught Signal" | 7 | echo "Caught Signal" |
8 | echo 1 | 8 | echo 1 |
9 | sleep 1 | 9 | sleep 1 |
10 | echo 2 | 10 | echo 2 |
11 | sleep 1 | 11 | sleep 1 |
12 | echo 3 | 12 | echo 3 |
13 | sleep 1 | 13 | sleep 1 |
14 | echo 4 | 14 | echo 4 |
15 | sleep 1 | 15 | sleep 1 |
16 | echo 5 | 16 | echo 5 |
17 | sleep 1 | 17 | sleep 1 |
18 | 18 | ||
19 | echo 10 | 19 | echo 10 |
20 | sleep 1 | 20 | sleep 1 |
21 | echo 20 | 21 | echo 20 |
22 | sleep 1 | 22 | sleep 1 |
23 | echo 30 | 23 | echo 30 |
24 | sleep 1 | 24 | sleep 1 |
25 | echo 40 | 25 | echo 40 |
26 | sleep 1 | 26 | sleep 1 |
27 | echo 50 | 27 | echo 50 |
28 | sleep 1 | 28 | sleep 1 |
29 | 29 | ||
30 | echo 100 | 30 | echo 100 |
31 | sleep 1 | 31 | sleep 1 |
32 | echo 200 | 32 | echo 200 |
33 | sleep 1 | 33 | sleep 1 |
34 | echo 300 | 34 | echo 300 |
35 | sleep 1 | 35 | sleep 1 |
36 | echo 400 | 36 | echo 400 |
37 | sleep 1 | 37 | sleep 1 |
38 | echo 500 | 38 | echo 500 |
39 | sleep 1 | 39 | sleep 1 |
40 | 40 | ||
41 | kill $pid | 41 | kill $pid |
42 | exit | 42 | exit |
43 | } | 43 | } |
44 | 44 | ||
45 | trap _term SIGTERM | 45 | trap _term SIGTERM |
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index 102c8df17..647cbfb34 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | if [ -f /etc/debian_version ]; then | 10 | if [[ -f /etc/debian_version ]]; then |
11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") | 11 | libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") |
12 | export PATH="$PATH:$libdir" | 12 | export PATH="$PATH:$libdir" |
13 | fi | 13 | fi |
@@ -33,13 +33,12 @@ echo "TESTING: version (test/utils/version.exp)" | |||
33 | echo "TESTING: help (test/utils/help.exp)" | 33 | echo "TESTING: help (test/utils/help.exp)" |
34 | ./help.exp | 34 | ./help.exp |
35 | 35 | ||
36 | which man 2>/dev/null | 36 | if command -v man |
37 | if [ "$?" -eq 0 ]; | ||
38 | then | 37 | then |
39 | echo "TESTING: man (test/utils/man.exp)" | 38 | echo "TESTING: man (test/utils/man.exp)" |
40 | ./man.exp | 39 | ./man.exp |
41 | else | 40 | else |
42 | echo "TESTING SKIP: man not found" | 41 | echo "TESTING SKIP: man not found" |
43 | fi | 42 | fi |
44 | 43 | ||
45 | echo "TESTING: list (test/utils/list.exp)" | 44 | echo "TESTING: list (test/utils/list.exp)" |
@@ -48,12 +47,12 @@ echo "TESTING: list (test/utils/list.exp)" | |||
48 | echo "TESTING: tree (test/utils/tree.exp)" | 47 | echo "TESTING: tree (test/utils/tree.exp)" |
49 | ./tree.exp | 48 | ./tree.exp |
50 | 49 | ||
51 | if [ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]; | 50 | if [[ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]] |
52 | then | 51 | then |
53 | echo "TESTING: cpu.print (test/utils/cpu-print.exp)" | 52 | echo "TESTING: cpu.print (test/utils/cpu-print.exp)" |
54 | ./cpu-print.exp | 53 | ./cpu-print.exp |
55 | else | 54 | else |
56 | echo "TESTING SKIP: cpu.print, not enough CPUs" | 55 | echo "TESTING SKIP: cpu.print, not enough CPUs" |
57 | fi | 56 | fi |
58 | 57 | ||
59 | echo "TESTING: fs.print (test/utils/fs-print.exp)" | 58 | echo "TESTING: fs.print (test/utils/fs-print.exp)" |