aboutsummaryrefslogtreecommitdiffstats
path: root/test/environment
diff options
context:
space:
mode:
authorLibravatar a1346054 <36859588+a1346054@users.noreply.github.com>2022-09-13 18:42:15 +0000
committerLibravatar a1346054 <36859588+a1346054@users.noreply.github.com>2022-09-13 22:37:18 +0000
commite04d6b7bf58a95105a8fc79fcde7c0e98875e72a (patch)
tree6e20913ed5d4af3e1b0ef5a31ef80ee42f651376 /test/environment
parenttests: fix unintentional overwriting of array value (diff)
downloadfirejail-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')
-rwxr-xr-xtest/environment/environment.sh9
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)"
39echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" 39echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
40./firejail-in-firejail.exp 40./firejail-in-firejail.exp
41 41
42which aplay 2>/dev/null 42if command -v aplay && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ];
43if [ "$?" -eq 0 ] && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ];
44then 43then
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)"
54echo "TESTING: quiet (test/environment/quiet.exp)" 53echo "TESTING: quiet (test/environment/quiet.exp)"
55./quiet.exp 54./quiet.exp
56 55
57which strace 2>/dev/null 56if command -v strace
58if [ "$?" -eq 0 ];
59then 57then
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
70find ~/.config/ibus/bus | grep unix-0 68if find ~/.config/ibus/bus | grep unix-0
71if [ "$?" -eq 0 ];
72then 69then
73 echo "TESTING: ibus (test/environment/ibus.exp)" 70 echo "TESTING: ibus (test/environment/ibus.exp)"
74 ./ibus.exp 71 ./ibus.exp