From e04d6b7bf58a95105a8fc79fcde7c0e98875e72a Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Tue, 13 Sep 2022 18:42:15 +0000 Subject: 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` --- test/apps-x11-xorg/apps-x11-xorg.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'test/apps-x11-xorg') 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 export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) export LC_ALL=C -which firefox 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v firefox then echo "TESTING: firefox x11 xorg" ./firefox.exp @@ -16,8 +15,7 @@ else echo "TESTING SKIP: firefox not found" fi -which transmission-gtk 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v transmission-gtk then echo "TESTING: transmission-gtk x11 xorg" ./transmission-gtk.exp @@ -25,8 +23,7 @@ else echo "TESTING SKIP: transmission-gtk not found" fi -which transmission-qt 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v transmission-qt then echo "TESTING: transmission-qt x11 xorg" ./transmission-qt.exp @@ -34,8 +31,7 @@ else echo "TESTING SKIP: transmission-qt not found" fi -which thunderbird 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v thunderbird then echo "TESTING: thunderbird x11 xorg" ./thunderbird.exp -- cgit v1.2.3-54-g00ecf