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/overlay | |
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/overlay')
-rwxr-xr-x | test/overlay/overlay.sh | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh index 490b180e1..9bc458f50 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 |
@@ -42,14 +40,12 @@ fi | |||
42 | 40 | ||
43 | 41 | ||
44 | # check xpra/xephyr | 42 | # check xpra/xephyr |
45 | which xpra 2>/dev/null | 43 | if command -v xpra |
46 | if [ "$?" -eq 0 ]; | ||
47 | then | 44 | then |
48 | echo "xpra found" | 45 | echo "xpra found" |
49 | else | 46 | else |
50 | echo "xpra not found" | 47 | echo "xpra not found" |
51 | which Xephyr 2>/dev/null | 48 | if command -v Xephyr |
52 | if [ "$?" -eq 0 ]; | ||
53 | then | 49 | then |
54 | echo "Xephyr found" | 50 | echo "Xephyr found" |
55 | else | 51 | else |
@@ -58,8 +54,7 @@ else | |||
58 | fi | 54 | fi |
59 | fi | 55 | fi |
60 | 56 | ||
61 | which firefox 2>/dev/null | 57 | if command -v firefox |
62 | if [ "$?" -eq 0 ]; | ||
63 | then | 58 | then |
64 | echo "TESTING: overlay firefox x11" | 59 | echo "TESTING: overlay firefox x11" |
65 | ./firefox-x11.exp | 60 | ./firefox-x11.exp |