From 034f4cfab8b6690e07f5b9cfaaa5cb31ac29336e Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 5 Aug 2019 10:12:23 +1000 Subject: [PATCH] ctdb-tests: Avoid shellcheck warning SC2164 SC2164 Use 'cd ... || exit' or 'cd ... || return' in case cd fails Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/run_tests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index 087eae4257b..5d2d3ff560b 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -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.