Files
neovim/cmake/RunTests.cmake
John Szakmeister 5ba1d980fb build: fix running of functional tests directly with CMake
If you aren't just building everything into build/, then the functional
tests fail because they can't find the nvim executable.  Let's pass in
the location of the nvim executable, and set NVIM_PRG environment
variable accordingly.
2014-11-05 07:26:35 -05:00

28 lines
722 B
CMake

get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
if(NVIM_PRG)
set(ENV{NVIM_PROG} "${NVIM_PRG}")
endif()
if(DEFINED ENV{TEST_FILE})
set(TEST_DIR $ENV{TEST_FILE})
endif()
if(TEST_TYPE STREQUAL "functional")
execute_process(
COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
--lpath=${BUILD_DIR}/?.lua ${TEST_DIR}/functional
WORKING_DIRECTORY ${WORKING_DIR}
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)
message(FATAL_ERROR "Unit tests failed.")
endif()