diff options
Diffstat (limited to 'tests/config/runtest.sh')
-rwxr-xr-x | tests/config/runtest.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/config/runtest.sh b/tests/config/runtest.sh new file mode 100755 index 0000000..11d9b46 --- /dev/null +++ b/tests/config/runtest.sh @@ -0,0 +1,23 @@ +#!/bin/bash -e +export SOURCE_PATH="$(cd "$(dirname "$0")" && pwd -P)" +export TEST_FILE="${2}" +TEST_DIR="$(dirname $TEST_FILE)" +export TMP_RUNDIR="$(mktemp -d)" +export KRESD_NO_LISTEN=1 +function finish { + rm -rf "${TMP_RUNDIR}" +} +trap finish EXIT + + +echo "# $(basename ${TEST_FILE})" +cp -a "${TEST_DIR}/"* "${TMP_RUNDIR}/" +CMDLINE_ARGS="$(cat "${TEST_FILE%.test.lua}.args" 2>/dev/null || echo "")" +EXPECTED_RETURNCODE="$(cat "${TEST_FILE%.test.lua}.returncode" 2>/dev/null || echo 0)" +set +e +${DEBUGGER} ${1} -f 1 -c ${SOURCE_PATH}/test.cfg $CMDLINE_ARGS "${TMP_RUNDIR}" +RETCODE="$?" +if [ "$RETCODE" -ne "$EXPECTED_RETURNCODE" ]; then + echo "Expected return code '$EXPECTED_RETURNCODE' got '$RETCODE'." +fi +test "$RETCODE" -eq "$EXPECTED_RETURNCODE" |