diff --git a/test/macros.cmake b/test/macros.cmake index 85f0e65..39e852c 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -5,7 +5,7 @@ include(CMakeParseArguments) function(ovni_test source) set(switches MP SHOULD_FAIL NOEMU SORT BREAKDOWN DISABLED) - set(single NPROC REGEX NAME) + set(single NPROC REGEX NAME DRIVER) set(multi ENV) cmake_parse_arguments( @@ -61,6 +61,11 @@ function(ovni_test source) list(APPEND OVNI_TEST_ENV "OVNI_EMU_ARGS=-b") endif() + if(OVNI_TEST_DRIVER) + list(APPEND OVNI_TEST_ENV + "OVNI_DRIVER=${CMAKE_CURRENT_SOURCE_DIR}/${OVNI_TEST_DRIVER}") + endif() + include_directories( "${CMAKE_SOURCE_DIR}/src/include" "${CMAKE_SOURCE_DIR}/src/emu" diff --git a/test/ovni-driver.sh b/test/ovni-driver.sh index 5cb8ffd..eeb80bf 100755 --- a/test/ovni-driver.sh +++ b/test/ovni-driver.sh @@ -12,8 +12,9 @@ dir=$(readlink -f "${OVNI_CURRENT_DIR}") testname="$dir/$1" workdir="${testname}.dir" tracedir="${workdir}/ovni" -emubin="${OVNI_BUILD_DIR}/ovniemu" -sortbin="${OVNI_BUILD_DIR}/ovnisort" + +export PATH="${OVNI_BUILD_DIR}:$PATH" +export OVNI_TEST_BIN="$testname" rm -rf "${workdir}" mkdir -p "${workdir}" @@ -23,23 +24,28 @@ if [ -z "$OVNI_NPROCS" ]; then OVNI_NPROCS=1 fi -if [ "$OVNI_NPROCS" -gt 1 ]; then - for i in $(seq 1 "$OVNI_NPROCS"); do - # Run the test in the background - OVNI_RANK=$(($i-1)) OVNI_NRANKS=$OVNI_NPROCS "$testname" & - done - wait +# Let the test run its own driver +if [ -n "$OVNI_DRIVER" ]; then + . "$OVNI_DRIVER" else - "$testname" -fi + if [ "$OVNI_NPROCS" -gt 1 ]; then + for i in $(seq 1 "$OVNI_NPROCS"); do + # Run the test in the background + OVNI_RANK=$(($i-1)) OVNI_NRANKS=$OVNI_NPROCS "$testname" & + done + wait + else + "$testname" + fi -if [ -n "$OVNI_DO_SORT" ]; then - "$sortbin" "$tracedir" -fi + if [ -n "$OVNI_DO_SORT" ]; then + ovnisort "$tracedir" + fi -if [ -z "$OVNI_NOEMU" ]; then - # Then launch the emulator in lint mode - "$emubin" $OVNI_EMU_ARGS -l "$tracedir" + if [ -z "$OVNI_NOEMU" ]; then + # Then launch the emulator in lint mode + ovniemu $OVNI_EMU_ARGS -l "$tracedir" + fi fi # Run any post script that was generated