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")
|
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)
|
2021-10-12 20:12:11 -07:00
|
|
|
unset(ENV{XDG_DATA_DIRS})
|
2022-06-08 08:47:34 -07:00
|
|
|
unset(ENV{NVIM}) # Clear $NVIM in case tests are running from Nvim. #11009
|
2014-11-04 11:44:43 -07:00
|
|
|
|
2022-10-17 08:16:31 -07:00
|
|
|
# TODO(dundargoc): The CIRRUS_CI environment variable isn't passed to here from
|
|
|
|
# the main CMakeLists.txt, so we have to manually pass it to this script and
|
|
|
|
# re-set the environment variable. Investigate if we can avoid manually setting
|
|
|
|
# it like with the GITHUB_CI environment variable.
|
|
|
|
set(ENV{CIRRUS_CI} ${CIRRUS_CI})
|
|
|
|
|
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()
|
|
|
|
|
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()
|
|
|
|
|
2021-12-18 09:07:30 -07:00
|
|
|
if(DEFINED ENV{TEST_FILTER_OUT} AND NOT "$ENV{TEST_FILTER_OUT}" STREQUAL "")
|
|
|
|
list(APPEND BUSTED_ARGS --filter-out $ENV{TEST_FILTER_OUT})
|
|
|
|
endif()
|
|
|
|
|
2022-06-23 16:15:55 -07:00
|
|
|
# TMPDIR: for helpers.tmpname() and Nvim tempname().
|
|
|
|
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir")
|
2019-06-21 21:44:52 -07:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})
|
|
|
|
|
2021-09-10 02:21:29 -07:00
|
|
|
# HISTFILE: do not write into user's ~/.bash_history
|
|
|
|
set(ENV{HISTFILE} "/dev/null")
|
|
|
|
|
2021-09-09 17:49:26 -07:00
|
|
|
if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "")
|
|
|
|
set(ENV{TEST_TIMEOUT} 1200)
|
|
|
|
endif()
|
|
|
|
|
2019-06-27 11:14:00 -07:00
|
|
|
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
|
2023-01-30 12:36:49 -07:00
|
|
|
|
2023-09-11 10:01:00 -07:00
|
|
|
if(NOT WIN32)
|
|
|
|
# Tests assume POSIX "sh" and may fail if SHELL=fish. #24941 #6172
|
|
|
|
set(ENV{SHELL} sh)
|
|
|
|
endif()
|
|
|
|
|
2014-11-05 05:50:33 -07:00
|
|
|
execute_process(
|
2023-07-01 03:45:45 -07:00
|
|
|
# Note: because of "-ll" (low-level interpreter mode), some modules like
|
|
|
|
# _editor.lua are not loaded.
|
2023-11-24 05:28:15 -07:00
|
|
|
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -v -o test.busted.outputHandlers.nvim
|
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-09 17:49:26 -07:00
|
|
|
TIMEOUT $ENV{TEST_TIMEOUT}
|
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
|
|
|
|
2023-05-13 03:12:29 -07:00
|
|
|
if(res)
|
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).
|
2023-02-12 06:42:00 -07:00
|
|
|
if(CI_BUILD)
|
2019-07-24 09:12:55 -07:00
|
|
|
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()
|
|
|
|
|
2022-03-02 17:16:31 -07:00
|
|
|
message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
|
2014-09-29 05:43:52 -07:00
|
|
|
endif()
|