CMake: Fix running individual (functional/unit) test.

This commit is contained in:
Florian Walch
2014-11-05 13:50:33 +01:00
parent e0628dab49
commit afa5831d73

View File

@@ -1,27 +1,22 @@
get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH) get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}") set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
if(NVIM_PRG) if(NVIM_PRG)
set(ENV{NVIM_PROG} "${NVIM_PRG}") set(ENV{NVIM_PROG} "${NVIM_PRG}")
endif() endif()
if(DEFINED ENV{TEST_FILE}) if(DEFINED ENV{TEST_FILE})
set(TEST_DIR $ENV{TEST_FILE}) set(TEST_PATH "$ENV{TEST_FILE}")
else()
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
endif() endif()
if(TEST_TYPE STREQUAL "functional") execute_process(
execute_process( COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE} --lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
--lpath=${BUILD_DIR}/?.lua ${TEST_DIR}/functional WORKING_DIRECTORY ${WORKING_DIR}
WORKING_DIRECTORY ${WORKING_DIR} RESULT_VARIABLE res)
RESULT_VARIABLE res)
else()
execute_process(
COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
--lpath=${BUILD_DIR}/?.lua ${TEST_DIR}/unit
WORKING_DIRECTORY ${WORKING_DIR}
RESULT_VARIABLE res)
endif()
if(NOT res EQUAL 0) if(NOT res EQUAL 0)
message(FATAL_ERROR "Unit tests failed.") message(FATAL_ERROR "Running ${TEST_TYPE} tests failed.")
endif() endif()