]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Avoid shellcheck warning SC2164
authorMartin Schwenke <martin@meltin.net>
Mon, 5 Aug 2019 00:12:23 +0000 (10:12 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 14 Aug 2019 09:11:34 +0000 (09:11 +0000)
SC2164 Use 'cd ... || exit' or 'cd ... || return' in case cd fails

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/run_tests.sh

index 087eae4257bbb65b31c3f592203aa6a7127f42c4..5d2d3ff560b32a14b636e60fbe3eb7a89cd0fe24 100755 (executable)
@@ -300,7 +300,10 @@ for f in "${tests[@]}" ; do
 
     if [ $status -eq 127 ] ; then
        # Find the the top-level tests directory
-       d=$(cd "$TEST_SCRIPTS_DIR"; echo "$PWD")
+       d=$(cd "$TEST_SCRIPTS_DIR" && echo "$PWD")
+       if [ -z "$d" ] ; then
+           die "Unable to find TEST_SCRIPTS_DIR=\"${TEST_SCRIPTS_DIR}\""
+       fi
        tests_dir=$(dirname "$d")
        # Strip off current directory from beginning, if there, just
        # to make paths more friendly.