--- /dev/null
+#!/bin/bash
+# Utility script used by meson to run config tests post installation
+set -o nounset -o errexit
+
+# if anything fails during test setup, use exit code 77 to mark it as skipped
+function skip {
+ exit 77
+}
+trap skip ERR
+
+TEST_DIR="$(dirname ${TEST_FILE})"
+TMP_RUNDIR="$(mktemp -d)"
+
+function finish {
+ rm -rf "${TMP_RUNDIR}"
+}
+trap finish EXIT
+
+cp -a "${TEST_DIR}/"* "${TMP_RUNDIR}/"
+cd "${TMP_RUNDIR}"
+
+test -x "${KRESD_EXEC}" || (echo "${KRESD_EXEC} not executable!"; exit 77)
+trap ERR # get actual kresd error code from now on
+
+${KRESD_EXEC} "$@"
if get_option('daemon')
+ run_configtest = find_program('../../scripts/test-config.sh')
foreach config_test : config_tests
- conftest_dir = join_paths(meson.current_build_dir(), config_test[0])
-
- testdir_clean = custom_target(
- 'config.' + config_test[0] + ': clean testdir',
- command: [
- 'rm', '-r', '-f', conftest_dir,
- ],
- output: config_test[0] + '.rm',
- build_by_default: false,
- )
-
- testdir_create = custom_target(
- 'config.' + config_test[0] + ': create testdir',
- command: [
- 'mkdir', conftest_dir,
- ],
- depends: testdir_clean,
- output: config_test[0],
- build_always_stale: true, # make sure to always recreate dir
- build_by_default: false,
- )
-
# kresd arguments
conftest_args = [
'-c', files('test.cfg'),
test(
'config.' + config_test[0],
- kresd,
+ run_configtest,
args: conftest_args,
env: [
'KRESD_NO_LISTEN=1',
'SOURCE_PATH=@0@'.format(meson.current_source_dir()),
'TEST_FILE=@0@/@1@'.format(meson.source_root(), config_test[1][0]),
+ 'KRESD_EXEC=@0@'.format(kresd_install_path),
+ ],
+ suite: [
+ 'postinstall',
+ 'config',
],
- suite: 'config',
- workdir: join_paths(meson.current_build_dir(), config_test[0]),
- depends: testdir_create,
should_fail: conftest_should_fail,
)
endforeach
+++ /dev/null
-#!/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"