diff options
author | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 18:42:15 +0000 |
---|---|---|
committer | a1346054 <36859588+a1346054@users.noreply.github.com> | 2022-09-13 22:37:18 +0000 |
commit | e04d6b7bf58a95105a8fc79fcde7c0e98875e72a (patch) | |
tree | 6e20913ed5d4af3e1b0ef5a31ef80ee42f651376 /test/apps-x11-xorg/apps-x11-xorg.sh | |
parent | tests: fix unintentional overwriting of array value (diff) | |
download | firejail-e04d6b7bf58a95105a8fc79fcde7c0e98875e72a.tar.gz firejail-e04d6b7bf58a95105a8fc79fcde7c0e98875e72a.tar.zst firejail-e04d6b7bf58a95105a8fc79fcde7c0e98875e72a.zip |
tests: directly test for presence of command
Test directly for presence of command instead of indirectly testing
the return code.
Additionally:
* uses a shell builtin `command -v` instead of external `which`
* `command -v` is the standardized version of `which`
Diffstat (limited to 'test/apps-x11-xorg/apps-x11-xorg.sh')
-rwxr-xr-x | test/apps-x11-xorg/apps-x11-xorg.sh | 12 |
1 files changed, 4 insertions, 8 deletions
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 |