diff options
Diffstat (limited to 'bin/tests/system/system-test-driver.sh')
-rwxr-xr-x | bin/tests/system/system-test-driver.sh | 72 |
1 files changed, 51 insertions, 21 deletions
diff --git a/bin/tests/system/system-test-driver.sh b/bin/tests/system/system-test-driver.sh index cf4d5f2..5ba23bf 100755 --- a/bin/tests/system/system-test-driver.sh +++ b/bin/tests/system/system-test-driver.sh @@ -15,7 +15,7 @@ # shellcheck disable=SC2034 usage() { - echo "$0 --test-name=NAME --log-file=PATH.log --trs-file=PATH.trs --color-tests={yes|no} --expect-failure={yes|no} --enable-hard-errors={yes|no}" + echo "$0 --test-name=NAME --log-file=PATH.log --trs-file=PATH.trs --color-tests={yes|no} --expect-failure={yes|no} --enable-hard-errors={yes|no}" } # @@ -23,13 +23,16 @@ usage() { # getopt --test >/dev/null if [ "$?" -ne 4 ]; then - echo "fatal: GNU getopt is required" - exit 1 + echo "fatal: GNU getopt is required" + exit 1 fi OPTS=$(getopt --shell "sh" --name "$(basename "$0")" --options '' --longoptions test-name:,log-file:,trs-file:,color-tests:,expect-failure:,enable-hard-errors: -- "$@") -if [ "$?" != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi +if [ "$?" != 0 ]; then + echo "Failed parsing options." >&2 + exit 1 +fi eval set -- "$OPTS" @@ -41,40 +44,67 @@ EXPECT_FAILURE=no HARD_ERRORS=yes while true; do - case "$1" in - --test-name ) TEST_NAME="$2"; shift; shift ;; - --log-file ) LOG_FILE="$2"; shift; shift ;; - --trs-file ) TRS_FILE="$2"; shift; shift ;; - --color-tests ) COLOR_TESTS="$2"; shift; shift ;; - --expect-failure ) EXPECT_FAILURE="$2"; shift; shift ;; - --hard-errors ) HARD_ERRORS="$2"; shift; shift ;; - -- ) shift; break ;; - *) break ;; - esac + case "$1" in + --test-name) + TEST_NAME="$2" + shift + shift + ;; + --log-file) + LOG_FILE="$2" + shift + shift + ;; + --trs-file) + TRS_FILE="$2" + shift + shift + ;; + --color-tests) + COLOR_TESTS="$2" + shift + shift + ;; + --expect-failure) + EXPECT_FAILURE="$2" + shift + shift + ;; + --hard-errors) + HARD_ERRORS="$2" + shift + shift + ;; + --) + shift + break + ;; + *) break ;; + esac done if [ -z "$1" ]; then - echo "fatal: test name required" - usage - exit 1 + echo "fatal: test name required" + usage + exit 1 fi TEST_PROGRAM="$1" shift if [ -z "$TEST_NAME" ]; then - TEST_NAME="$(basename "$TEST_PROGRAM")" + TEST_NAME="$(basename "$TEST_PROGRAM")" fi if [ -z "$LOG_FILE" ]; then - LOG_FILE="$TEST_PROGRAM.log" + LOG_FILE="$TEST_PROGRAM.log" fi if [ -z "$TRS_FILE" ]; then - TRS_FILE="$TEST_PROGRAM.trs" + TRS_FILE="$TEST_PROGRAM.trs" fi echo "Running $TEST_PROGRAM" random=$(awk 'BEGIN { srand(); print int(rand()*32768) }' /dev/null) -./run.sh -p "$((random%32000+32000))" "$@" "$TEST_PROGRAM" +./run.sh -p "$((random % 32000 + 32000))" "$@" "$TEST_PROGRAM" exit $? |