2017-07-28 15:34:14 -07:00
|
|
|
# Set LC_ALL to meet expectations of some locale-sensitive tests.
|
|
|
|
set(ENV{LC_ALL} "en_US.UTF-8")
|
|
|
|
|
2019-07-24 09:12:55 -07:00
|
|
|
if(POLICY CMP0012)
|
|
|
|
# Handle CI=true, without dev warnings.
|
|
|
|
cmake_policy(SET CMP0012 NEW)
|
|
|
|
endif()
|
|
|
|
|
2014-11-04 11:44:43 -07:00
|
|
|
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
|
2019-06-21 21:44:52 -07:00
|
|
|
set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest)
|
|
|
|
set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config)
|
|
|
|
set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share)
|
2014-11-04 11:44:43 -07:00
|
|
|
|
2017-05-31 01:45:20 -07:00
|
|
|
if(NOT DEFINED ENV{NVIM_LOG_FILE})
|
2019-06-21 21:44:52 -07:00
|
|
|
set(ENV{NVIM_LOG_FILE} ${BUILD_DIR}/.nvimlog)
|
2017-05-31 01:45:20 -07:00
|
|
|
endif()
|
|
|
|
|
2014-11-05 05:26:35 -07:00
|
|
|
if(NVIM_PRG)
|
2017-02-11 17:02:54 -07:00
|
|
|
set(ENV{NVIM_PRG} "${NVIM_PRG}")
|
2014-11-05 05:26:35 -07:00
|
|
|
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}")
|
2019-07-19 04:51:18 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Force $TEST_PATH to workdir-relative path ("test/…").
|
|
|
|
if(IS_ABSOLUTE ${TEST_PATH})
|
|
|
|
file(RELATIVE_PATH TEST_PATH "${WORKING_DIR}" "${TEST_PATH}")
|
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()
|
|
|
|
|
2019-06-21 21:44:52 -07:00
|
|
|
set(BUSTED_ARGS $ENV{BUSTED_ARGS})
|
|
|
|
separate_arguments(BUSTED_ARGS)
|
|
|
|
|
2018-06-15 16:45:50 -07:00
|
|
|
if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
|
2019-06-29 10:15:48 -07:00
|
|
|
list(APPEND BUSTED_ARGS --tags $ENV{TEST_TAG})
|
2015-03-17 04:48:03 -07:00
|
|
|
endif()
|
|
|
|
|
2018-06-15 16:45:50 -07:00
|
|
|
if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
|
2019-06-29 10:15:48 -07:00
|
|
|
list(APPEND BUSTED_ARGS --filter $ENV{TEST_FILTER})
|
2015-03-17 04:48:03 -07:00
|
|
|
endif()
|
|
|
|
|
2019-06-21 21:44:52 -07:00
|
|
|
# TMPDIR: use relative test path (for parallel test runs / isolation).
|
2019-07-19 04:51:18 -07:00
|
|
|
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}")
|
2019-06-21 21:44:52 -07:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})
|
|
|
|
|
2019-06-27 11:14:00 -07:00
|
|
|
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
|
2014-11-05 05:50:33 -07:00
|
|
|
execute_process(
|
2019-07-16 13:02:50 -07:00
|
|
|
COMMAND ${BUSTED_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
|
2019-06-23 23:47:02 -07:00
|
|
|
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
2018-11-29 14:51:20 -07:00
|
|
|
--lpath=${BUILD_DIR}/?.lua
|
|
|
|
--lpath=${WORKING_DIR}/runtime/lua/?.lua
|
|
|
|
--lpath=?.lua
|
2019-06-21 21:44:52 -07:00
|
|
|
${BUSTED_ARGS}
|
2018-11-29 14:51:20 -07:00
|
|
|
${TEST_PATH}
|
2021-09-08 07:21:28 -07:00
|
|
|
TIMEOUT 1200
|
2014-11-05 05:50:33 -07:00
|
|
|
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
|
|
|
|
2019-06-21 21:44:52 -07:00
|
|
|
file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*)
|
|
|
|
file(REMOVE_RECURSE ${RM_FILES})
|
2016-08-15 20:25:02 -07:00
|
|
|
|
2014-09-29 05:43:52 -07:00
|
|
|
if(NOT res EQUAL 0)
|
2019-07-24 09:12:55 -07:00
|
|
|
message(STATUS "Tests exited non-zero: ${res}")
|
|
|
|
if("${err}" STREQUAL "")
|
|
|
|
message(STATUS "No output to stderr.")
|
|
|
|
else()
|
|
|
|
message(STATUS "Output to stderr:\n${err}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Dump the logfile on CI (if not displayed and moved already).
|
|
|
|
if($ENV{CI})
|
|
|
|
if(EXISTS $ENV{NVIM_LOG_FILE} AND NOT EXISTS $ENV{NVIM_LOG_FILE}.displayed)
|
|
|
|
file(READ $ENV{NVIM_LOG_FILE} out)
|
|
|
|
message(STATUS "$NVIM_LOG_FILE: $ENV{NVIM_LOG_FILE}\n${out}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-10-06 09:45:34 -07:00
|
|
|
message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
|
2014-09-29 05:43:52 -07:00
|
|
|
endif()
|