From afa5831d73f9f82af5dac3ef4948e801e17fc41f Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Wed, 5 Nov 2014 13:50:33 +0100 Subject: [PATCH] CMake: Fix running individual (functional/unit) test. --- cmake/RunTests.cmake | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index b926e31994..9a3e8c296e 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -1,27 +1,22 @@ 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}) + set(TEST_PATH "$ENV{TEST_FILE}") +else() + set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}") 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() +execute_process( + COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE} + --lpath=${BUILD_DIR}/?.lua ${TEST_PATH} + WORKING_DIRECTORY ${WORKING_DIR} + RESULT_VARIABLE res) if(NOT res EQUAL 0) - message(FATAL_ERROR "Unit tests failed.") + message(FATAL_ERROR "Running ${TEST_TYPE} tests failed.") endif()