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/apps-x11.sh | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'test/apps-x11') diff --git a/test/apps-x11/apps-x11.sh b/test/apps-x11/apps-x11.sh index a3c946ca4..9f8102738 100755 --- a/test/apps-x11/apps-x11.sh +++ b/test/apps-x11/apps-x11.sh @@ -11,21 +11,18 @@ echo "TESTING: no x11 (test/apps-x11/x11-none.exp)" ./x11-none.exp -which xterm 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v xterm then echo "TESTING: xterm x11 xorg" ./xterm-xorg.exp - which xpra 2>/dev/null - if [ "$?" -eq 0 ]; + if command -v xpra then echo "TESTING: xterm x11 xpra" ./xterm-xpra.exp fi - which Xephyr 2>/dev/null - if [ "$?" -eq 0 ]; + if command -v Xephyr then echo "TESTING: xterm x11 xephyr" ./xterm-xephyr.exp @@ -35,14 +32,12 @@ else fi # check xpra/xephyr -which xpra 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v xpra then echo "xpra found" else echo "xpra not found" - which Xephyr 2>/dev/null - if [ "$?" -eq 0 ]; + if command -v Xephyr then echo "Xephyr found" else @@ -51,8 +46,7 @@ else fi fi -which firefox 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v firefox then echo "TESTING: firefox x11" ./firefox.exp @@ -60,8 +54,7 @@ else echo "TESTING SKIP: firefox not found" fi -which chromium 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v chromium then echo "TESTING: chromium x11" ./chromium.exp @@ -69,8 +62,7 @@ else echo "TESTING SKIP: chromium not found" fi -which transmission-gtk 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v transmission-gtk then echo "TESTING: transmission-gtk x11" ./transmission-gtk.exp @@ -78,8 +70,7 @@ else echo "TESTING SKIP: transmission-gtk not found" fi -which thunderbird 2>/dev/null -if [ "$?" -eq 0 ]; +if command -v thunderbird then echo "TESTING: thunderbird x11" ./thunderbird.exp -- cgit v1.2.3-70-g09d2