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/environment/environment.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/environment/environment.sh')
-rwxr-xr-x | test/environment/environment.sh | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/test/environment/environment.sh b/test/environment/environment.sh index da9c170b9..f6acada73 100755 --- a/test/environment/environment.sh +++ b/test/environment/environment.sh | |||
@@ -39,8 +39,7 @@ echo "TESTING: environment variables (test/environment/env.exp)" | |||
39 | echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" | 39 | echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" |
40 | ./firejail-in-firejail.exp | 40 | ./firejail-in-firejail.exp |
41 | 41 | ||
42 | which aplay 2>/dev/null | 42 | if command -v aplay && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ]; |
43 | if [ "$?" -eq 0 ] && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ]; | ||
44 | then | 43 | then |
45 | echo "TESTING: sound (test/environment/sound.exp)" | 44 | echo "TESTING: sound (test/environment/sound.exp)" |
46 | ./sound.exp | 45 | ./sound.exp |
@@ -54,8 +53,7 @@ echo "TESTING: nice (test/environment/nice.exp)" | |||
54 | echo "TESTING: quiet (test/environment/quiet.exp)" | 53 | echo "TESTING: quiet (test/environment/quiet.exp)" |
55 | ./quiet.exp | 54 | ./quiet.exp |
56 | 55 | ||
57 | which strace 2>/dev/null | 56 | if command -v strace |
58 | if [ "$?" -eq 0 ]; | ||
59 | then | 57 | then |
60 | echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" | 58 | echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" |
61 | ./allow-debuggers.exp | 59 | ./allow-debuggers.exp |
@@ -67,8 +65,7 @@ fi | |||
67 | # $ sudo apt-get install ibus-table-array30 | 65 | # $ sudo apt-get install ibus-table-array30 |
68 | # $ ibus-setup | 66 | # $ ibus-setup |
69 | 67 | ||
70 | find ~/.config/ibus/bus | grep unix-0 | 68 | if find ~/.config/ibus/bus | grep unix-0 |
71 | if [ "$?" -eq 0 ]; | ||
72 | then | 69 | then |
73 | echo "TESTING: ibus (test/environment/ibus.exp)" | 70 | echo "TESTING: ibus (test/environment/ibus.exp)" |
74 | ./ibus.exp | 71 | ./ibus.exp |