diff options
author | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 20:21:21 +0000 |
---|---|---|
committer | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 22:37:20 +0000 |
commit | 7a5c2b205e4f0c3700f41f2ccd2b104476b8f026 (patch) | |
tree | 1a4f33f8d68139a6bdac2657ed2e9860efc194d6 | |
parent | tests: stop mixing tabs and spaces (diff) | |
download | firejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.tar.gz firejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.tar.zst firejail-7a5c2b205e4f0c3700f41f2ccd2b104476b8f026.zip |
tests: use bash-style [[...]] instead of [...]
-rwxr-xr-x | test/compile/compile.sh | 2 | ||||
-rwxr-xr-x | test/environment/environment.sh | 2 | ||||
-rwxr-xr-x | test/environment/output.sh | 2 | ||||
-rwxr-xr-x | test/fcopy/fcopy.sh | 2 | ||||
-rwxr-xr-x | test/features/test.sh | 4 | ||||
-rwxr-xr-x | test/filters/filters.sh | 22 | ||||
-rwxr-xr-x | test/fnetfilter/fnetfilter.sh | 2 | ||||
-rwxr-xr-x | test/fs/fs.sh | 6 | ||||
-rwxr-xr-x | test/root/root.sh | 10 | ||||
-rwxr-xr-x | test/utils/utils.sh | 4 |
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 | ||
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 |
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)" | |||
38 | 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)" |
39 | ./firejail-in-firejail.exp | 39 | ./firejail-in-firejail.exp |
40 | 40 | ||
41 | if command -v aplay && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ]; | 41 | if command -v aplay && [[ $(aplay -l | grep -c "List of PLAYBACK") -gt 0 ]] |
42 | then | 42 | then |
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 | ||
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)) |
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 | |||
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/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" | |||
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" |
@@ -61,7 +61,7 @@ echo "TESTING: 1.10 disable /selinux" | |||
61 | #################### | 61 | #################### |
62 | # networking features | 62 | # networking features |
63 | #################### | 63 | #################### |
64 | if [ $NETWORK == "network" ] | 64 | if [[ $NETWORK == "network" ]] |
65 | then | 65 | then |
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 | |||
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 |
@@ -33,7 +33,7 @@ fi | |||
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 |
@@ -61,7 +61,7 @@ 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 |
@@ -70,7 +70,7 @@ 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 |
@@ -80,10 +80,10 @@ fi | |||
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 |
@@ -114,14 +114,14 @@ echo "TESTING: seccomp chmod profile - seccomp lists (test/filters/seccomp-chmod | |||
114 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" | 114 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" |
115 | ./seccomp-empty.exp | 115 | ./seccomp-empty.exp |
116 | 116 | ||
117 | if [ "$(uname -m)" = "x86_64" ]; then | 117 | if [[ $(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 |
120 | else | 120 | else |
121 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" | 121 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" |
122 | fi | 122 | fi |
123 | 123 | ||
124 | if [ "$(uname -m)" = "x86_64" ]; then | 124 | if [[ $(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 |
127 | else | 127 | else |
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 07d33bee6..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,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 |
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)" |
@@ -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 |
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 |
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 | #******************************** |
27 | if [ -f /etc/init.d/snmpd ] | 27 | if [[ -f /etc/init.d/snmpd ]] |
28 | then | 28 | then |
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 | |||
33 | fi | 33 | fi |
34 | 34 | ||
35 | 35 | ||
36 | if [ -f /etc/init.d/apache2 ] | 36 | if [[ -f /etc/init.d/apache2 ]] |
37 | then | 37 | then |
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" |
42 | fi | 42 | fi |
43 | 43 | ||
44 | if [ -f /etc/init.d/isc-dhcp-server ] | 44 | if [[ -f /etc/init.d/isc-dhcp-server ]] |
45 | then | 45 | then |
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" |
50 | fi | 50 | fi |
51 | 51 | ||
52 | if [ -f /etc/init.d/unbound ] | 52 | if [[ -f /etc/init.d/unbound ]] |
53 | then | 53 | then |
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" |
58 | fi | 58 | fi |
59 | 59 | ||
60 | if [ -f /etc/init.d/nginx ] | 60 | if [[ -f /etc/init.d/nginx ]] |
61 | then | 61 | then |
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 | |||
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 |
@@ -47,7 +47,7 @@ echo "TESTING: list (test/utils/list.exp)" | |||
47 | echo "TESTING: tree (test/utils/tree.exp)" | 47 | echo "TESTING: tree (test/utils/tree.exp)" |
48 | ./tree.exp | 48 | ./tree.exp |
49 | 49 | ||
50 | if [ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]; | 50 | if [[ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]] |
51 | then | 51 | then |
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 |