2014-09-29 05:43:52 -07:00
|
|
|
get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
|
|
|
|
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
|
2014-11-05 05:50:33 -07:00
|
|
|
|
2014-11-04 11:44:43 -07:00
|
|
|
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
|
|
|
|
|
2014-11-05 05:26:35 -07:00
|
|
|
if(NVIM_PRG)
|
|
|
|
set(ENV{NVIM_PROG} "${NVIM_PRG}")
|
|
|
|
endif()
|
|
|
|
|
2014-09-29 05:43:52 -07:00
|
|
|
if(DEFINED ENV{TEST_FILE})
|
2014-11-05 05:50:33 -07:00
|
|
|
set(TEST_PATH "$ENV{TEST_FILE}")
|
2014-09-29 05:43:52 -07:00
|
|
|
else()
|
2014-11-05 05:50:33 -07:00
|
|
|
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
|
2014-09-29 05:43:52 -07:00
|
|
|
endif()
|
|
|
|
|
2015-03-21 06:47:49 -07:00
|
|
|
if(BUSTED_OUTPUT_TYPE STREQUAL junit)
|
|
|
|
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
|
|
|
endif()
|
|
|
|
|
2015-03-17 04:48:03 -07:00
|
|
|
if(DEFINED ENV{TEST_TAG})
|
|
|
|
set(TEST_TAG "--tags=$ENV{TEST_TAG}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(DEFINED ENV{TEST_FILTER})
|
|
|
|
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
|
|
|
|
endif()
|
|
|
|
|
2014-11-05 05:50:33 -07:00
|
|
|
execute_process(
|
2015-03-17 04:48:03 -07:00
|
|
|
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
|
|
|
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
2014-11-05 05:50:33 -07:00
|
|
|
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
|
|
|
|
WORKING_DIRECTORY ${WORKING_DIR}
|
2015-02-06 04:17:48 -07:00
|
|
|
ERROR_VARIABLE err
|
2015-03-21 06:47:49 -07:00
|
|
|
RESULT_VARIABLE res
|
|
|
|
${EXTRA_ARGS})
|
2014-11-05 05:50:33 -07:00
|
|
|
|
2014-09-29 05:43:52 -07:00
|
|
|
if(NOT res EQUAL 0)
|
2015-02-06 04:17:48 -07:00
|
|
|
message(STATUS "Output to stderr:\n${err}")
|
2014-11-25 04:15:57 -07:00
|
|
|
message(FATAL_ERROR "Running ${TEST_TYPE} tests failed with error: ${res}.")
|
2014-09-29 05:43:52 -07:00
|
|
|
endif()
|