diff options
author | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 19:47:01 +0000 |
---|---|---|
committer | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 22:37:18 +0000 |
commit | d7826c2384b6aa655d92b0570bebdc9cef8cb393 (patch) | |
tree | baf5c9a2353453a244b72581bd992ea503f741bb /test | |
parent | tests: directly test for presence of command (diff) | |
download | firejail-d7826c2384b6aa655d92b0570bebdc9cef8cb393.tar.gz firejail-d7826c2384b6aa655d92b0570bebdc9cef8cb393.tar.zst firejail-d7826c2384b6aa655d92b0570bebdc9cef8cb393.zip |
tests: use an array
Diffstat (limited to 'test')
-rwxr-xr-x | test/apps/apps.sh | 5 | ||||
-rwxr-xr-x | test/private-lib/private-lib.sh | 5 | ||||
-rwxr-xr-x | test/profiles/all-profiles.sh | 8 | ||||
-rwxr-xr-x | test/profiles/profiles.sh | 8 |
4 files changed, 12 insertions, 14 deletions
diff --git a/test/apps/apps.sh b/test/apps/apps.sh index ed4b7604a..0ef01bf2e 100755 --- a/test/apps/apps.sh +++ b/test/apps/apps.sh | |||
@@ -7,10 +7,9 @@ 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 | if command -v "$app" | 13 | if command -v "$app" |
15 | then | 14 | then |
16 | echo "TESTING: $app" | 15 | echo "TESTING: $app" |
diff --git a/test/private-lib/private-lib.sh b/test/private-lib/private-lib.sh index 86ed7b06d..6b7d433c8 100755 --- a/test/private-lib/private-lib.sh +++ b/test/private-lib/private-lib.sh | |||
@@ -7,10 +7,9 @@ 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 | ||
14 | if command -v "$app" | 13 | if command -v "$app" |
15 | then | 14 | then |
16 | echo "TESTING: private-lib $app" | 15 | echo "TESTING: private-lib $app" |
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 |