aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar a1346054 <36859588+a1346054@users.noreply.github.com>2022-09-13 20:21:21 +0000
committerLibravatar a1346054 <36859588+a1346054@users.noreply.github.com>2022-09-13 22:37:20 +0000
commit7a5c2b205e4f0c3700f41f2ccd2b104476b8f026 (patch)
tree1a4f33f8d68139a6bdac2657ed2e9860efc194d6 /test
parenttests: stop mixing tabs and spaces (diff)
downloadfirejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.tar.gz
firejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.tar.zst
firejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.zip
tests: use bash-style [[...]] instead of [...]
Diffstat (limited to 'test')
-rwxr-xr-xtest/compile/compile.sh2
-rwxr-xr-xtest/environment/environment.sh2
-rwxr-xr-xtest/environment/output.sh2
-rwxr-xr-xtest/fcopy/fcopy.sh2
-rwxr-xr-xtest/features/test.sh4
-rwxr-xr-xtest/filters/filters.sh22
-rwxr-xr-xtest/fnetfilter/fnetfilter.sh2
-rwxr-xr-xtest/fs/fs.sh6
-rwxr-xr-xtest/root/root.sh10
-rwxr-xr-xtest/utils/utils.sh4
10 files changed, 28 insertions, 28 deletions
diff --git a/test/compile/compile.sh b/test/compile/compile.sh
index 48c8dd2c4..0285c8935 100755
--- a/test/compile/compile.sh
+++ b/test/compile/compile.sh
@@ -52,7 +52,7 @@ print_title() {
52} 52}
53 53
54DIST="$1" 54DIST="$1"
55while [ $# -gt 0 ]; do # Until you run out of parameters . . . 55while [[ $# -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
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index ddc9a80a9..c88c91741 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -38,7 +38,7 @@ echo "TESTING: environment variables (test/environment/env.exp)"
38echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" 38echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
39./firejail-in-firejail.exp 39./firejail-in-firejail.exp
40 40
41if command -v aplay && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ]; 41if command -v aplay && [[ $(aplay -l | grep -c "List of PLAYBACK") -gt 0 ]]
42then 42then
43 echo "TESTING: sound (test/environment/sound.exp)" 43 echo "TESTING: sound (test/environment/sound.exp)"
44 ./sound.exp 44 ./sound.exp
diff --git a/test/environment/output.sh b/test/environment/output.sh
index 0872dc276..ba06f9184 100755
--- a/test/environment/output.sh
+++ b/test/environment/output.sh
@@ -5,7 +5,7 @@
5 5
6i="0" 6i="0"
7 7
8while [ $i -lt 150000 ] 8while [[ $i -lt 150000 ]]
9do 9do
10 echo "message number $i" 10 echo "message number $i"
11 i=$((i+1)) 11 i=$((i+1))
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
index 4433f8248..72b87d14c 100755
--- a/test/fcopy/fcopy.sh
+++ b/test/fcopy/fcopy.sh
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -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"
13fi 13fi
diff --git a/test/features/test.sh b/test/features/test.sh
index aaf5fd089..44677aaa7 100755
--- a/test/features/test.sh
+++ b/test/features/test.sh
@@ -8,7 +8,7 @@ OVERLAY="overlay"
8CHROOT="chroot" 8CHROOT="chroot"
9NETWORK="network" 9NETWORK="network"
10 10
11while [ $# -gt 0 ]; do # Until you run out of parameters . . . 11while [[ $# -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"
@@ -61,7 +61,7 @@ echo "TESTING: 1.10 disable /selinux"
61#################### 61####################
62# networking features 62# networking features
63#################### 63####################
64if [ $NETWORK == "network" ] 64if [[ $NETWORK == "network" ]]
65then 65then
66 echo "TESTING: 2.1 hostname" 66 echo "TESTING: 2.1 hostname"
67 ./2.1.exp "$OVERLAY" "$CHROOT" 67 ./2.1.exp "$OVERLAY" "$CHROOT"
diff --git a/test/filters/filters.sh b/test/filters/filters.sh
index 918f05adc..3b4a6b492 100755
--- a/test/filters/filters.sh
+++ b/test/filters/filters.sh
@@ -7,23 +7,23 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -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"
13fi 13fi
14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" 14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 15
16if [ -f /sys/kernel/security/apparmor/profiles ]; then 16if [[ -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
19else 19else
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)"
21fi 21fi
22 22
23if [ "$(uname -m)" = "x86_64" ]; then 23if [[ $(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
26elif [ "$(uname -m)" = "i686" ]; then 26elif [[ $(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
29else 29else
@@ -33,7 +33,7 @@ fi
33echo "TESTING: debug options (test/filters/debug.exp)" 33echo "TESTING: debug options (test/filters/debug.exp)"
34./debug.exp 34./debug.exp
35 35
36if [ "$(uname -m)" = "x86_64" ]; then 36if [[ $(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
39else 39else
@@ -61,7 +61,7 @@ echo "TESTING: capabilities join (test/filters/caps-join.exp)"
61./caps-join.exp 61./caps-join.exp
62 62
63rm -f seccomp-test-file 63rm -f seccomp-test-file
64if [ "$(uname -m)" = "x86_64" ]; then 64if [[ $(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
67else 67else
@@ -70,7 +70,7 @@ fi
70rm -f seccomp-test-file 70rm -f seccomp-test-file
71 71
72 72
73if [ "$(uname -m)" = "x86_64" ]; then 73if [[ $(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
76else 76else
@@ -80,10 +80,10 @@ fi
80echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" 80echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)"
81./seccomp-bad-empty.exp 81./seccomp-bad-empty.exp
82 82
83if [ "$(uname -m)" = "x86_64" ]; then 83if [[ $(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
86elif [ "$(uname -m)" = "i686" ]; then 86elif [[ $(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
89else 89else
@@ -114,14 +114,14 @@ echo "TESTING: seccomp chmod profile - seccomp lists (test/filters/seccomp-chmod
114echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" 114echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)"
115./seccomp-empty.exp 115./seccomp-empty.exp
116 116
117if [ "$(uname -m)" = "x86_64" ]; then 117if [[ $(uname -m) == "x86_64" ]]; then
118 echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" 118 echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)"
119 ./seccomp-numeric.exp 119 ./seccomp-numeric.exp
120else 120else
121 echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" 121 echo "TESTING SKIP: seccomp numeric test implemented only for x86_64"
122fi 122fi
123 123
124if [ "$(uname -m)" = "x86_64" ]; then 124if [[ $(uname -m) == "x86_64" ]]; then
125 echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" 125 echo "TESTING: seccomp join (test/filters/seccomp-join.exp)"
126 ./seccomp-join.exp 126 ./seccomp-join.exp
127else 127else
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
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -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"
13fi 13fi
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 07d33bee6..697c86d3d 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -34,7 +34,7 @@ rm -f ~/_firejail_test_dir
34echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" 34echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)"
35./sys_fs.exp 35./sys_fs.exp
36 36
37if [ -c /dev/kmsg ]; then 37if [[ -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
40else 40else
@@ -45,7 +45,7 @@ echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)"
45./fs_var_tmp.exp 45./fs_var_tmp.exp
46rm -f /var/tmp/_firejail_test_file 46rm -f /var/tmp/_firejail_test_file
47 47
48if [ "$(uname -m)" = "x86_64" ]; then 48if [[ $(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)"
@@ -60,7 +60,7 @@ echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)"
60./fs_var_lock.exp 60./fs_var_lock.exp
61rm -f /var/lock/_firejail_test_file 61rm -f /var/lock/_firejail_test_file
62 62
63if [ -w /dev/shm ]; then 63if [[ -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
diff --git a/test/root/root.sh b/test/root/root.sh
index 15c4bbd13..a39525b6e 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -24,7 +24,7 @@ fi
24#******************************** 24#********************************
25# servers 25# servers
26#******************************** 26#********************************
27if [ -f /etc/init.d/snmpd ] 27if [[ -f /etc/init.d/snmpd ]]
28then 28then
29 echo "TESTING: snmpd (test/root/snmpd.exp)" 29 echo "TESTING: snmpd (test/root/snmpd.exp)"
30 ./snmpd.exp 30 ./snmpd.exp
@@ -33,7 +33,7 @@ else
33fi 33fi
34 34
35 35
36if [ -f /etc/init.d/apache2 ] 36if [[ -f /etc/init.d/apache2 ]]
37then 37then
38 echo "TESTING: apache2 (test/root/apache2.exp)" 38 echo "TESTING: apache2 (test/root/apache2.exp)"
39 ./apache2.exp 39 ./apache2.exp
@@ -41,7 +41,7 @@ else
41 echo "TESTING SKIP: apache2 not found" 41 echo "TESTING SKIP: apache2 not found"
42fi 42fi
43 43
44if [ -f /etc/init.d/isc-dhcp-server ] 44if [[ -f /etc/init.d/isc-dhcp-server ]]
45then 45then
46 echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)" 46 echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)"
47 ./isc-dhcp.exp 47 ./isc-dhcp.exp
@@ -49,7 +49,7 @@ else
49 echo "TESTING SKIP: isc dhcp server not found" 49 echo "TESTING SKIP: isc dhcp server not found"
50fi 50fi
51 51
52if [ -f /etc/init.d/unbound ] 52if [[ -f /etc/init.d/unbound ]]
53then 53then
54 echo "TESTING: unbound (test/root/unbound.exp)" 54 echo "TESTING: unbound (test/root/unbound.exp)"
55 ./unbound.exp 55 ./unbound.exp
@@ -57,7 +57,7 @@ else
57 echo "TESTING SKIP: unbound not found" 57 echo "TESTING SKIP: unbound not found"
58fi 58fi
59 59
60if [ -f /etc/init.d/nginx ] 60if [[ -f /etc/init.d/nginx ]]
61then 61then
62 echo "TESTING: nginx (test/root/nginx.exp)" 62 echo "TESTING: nginx (test/root/nginx.exp)"
63 ./nginx.exp 63 ./nginx.exp
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index d1d006f4f..647cbfb34 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -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"
13fi 13fi
@@ -47,7 +47,7 @@ echo "TESTING: list (test/utils/list.exp)"
47echo "TESTING: tree (test/utils/tree.exp)" 47echo "TESTING: tree (test/utils/tree.exp)"
48./tree.exp 48./tree.exp
49 49
50if [ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]; 50if [[ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]]
51then 51then
52 echo "TESTING: cpu.print (test/utils/cpu-print.exp)" 52 echo "TESTING: cpu.print (test/utils/cpu-print.exp)"
53 ./cpu-print.exp 53 ./cpu-print.exp