From: Martin Schwenke Date: Sun, 8 Jul 2018 11:54:40 +0000 (+1000) Subject: ctdb-tests: Avoid use of non-portable getopt in run_tests.sh X-Git-Tag: ldb-1.5.0~128 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=56ffca3e79923a028ff96fbd50706d808b9dd215;p=thirdparty%2Fsamba.git ctdb-tests: Avoid use of non-portable getopt in run_tests.sh getopt is being used with non-portable options. Use simpler, POSIX-compliant getopts instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index 7e0b26deb66..8eead527b33 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -48,33 +48,27 @@ export TEST_CLEANUP=false export TEST_TIMEOUT=3600 export TEST_SOCKET_WRAPPER_SO_PATH="" -temp=$(getopt -n "$prog" -o "AcCdDehHNqS:T:vV:xX" -l help -- "$@") - -[ $? != 0 ] && usage - -eval set -- "$temp" - -while true ; do - case "$1" in - -A) TEST_CAT_RESULTS_OPTS="-A" ; shift ;; - -c) TEST_LOCAL_DAEMONS="" ; shift ;; - -C) TEST_CLEANUP=true ; shift ;; - -d) with_desc=true ; shift ;; # 4th line of output is description - -D) TEST_DIFF_RESULTS=true ; shift ;; - -e) exit_on_fail=true ; shift ;; - -H) no_header=true ; shift ;; - -N) with_summary=false ; shift ;; - -q) quiet=true ; shift ;; - -S) TEST_SOCKET_WRAPPER_SO_PATH="$2" ; shift 2 ;; - -T) TEST_TIMEOUT="$2" ; shift 2 ;; - -v) TEST_VERBOSE=true ; shift ;; - -V) TEST_VAR_DIR="$2" ; shift 2 ;; - -x) set -x; shift ;; - -X) TEST_COMMAND_TRACE=true ; shift ;; - --) shift ; break ;; - *) usage ;; - esac +while getopts "AcCdDehHNqS:T:vV:xX?" opt ; do + case "$opt" in + A) TEST_CAT_RESULTS_OPTS="-A" ;; + c) TEST_LOCAL_DAEMONS="" ;; + C) TEST_CLEANUP=true ;; + d) with_desc=true ;; # 4th line of output is description + D) TEST_DIFF_RESULTS=true ;; + e) exit_on_fail=true ;; + H) no_header=true ;; + N) with_summary=false ;; + q) quiet=true ;; + S) TEST_SOCKET_WRAPPER_SO_PATH="$OPTARG" ;; + T) TEST_TIMEOUT="$OPTARG" ;; + v) TEST_VERBOSE=true ;; + V) TEST_VAR_DIR="$OPTARG" ;; + x) set -x ;; + X) TEST_COMMAND_TRACE=true ;; + \?|h) usage ;; + esac done +shift $((OPTIND - 1)) case $(basename "$0") in *run_cluster_tests*)