mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
- Add support for TEST_FILE to the `oldtest` target, for consistency
with the busted/lua tests.
Caveat: with the busted/lua tests TEST_FILE takes a full path, whereas
for `oldtest` it must be "test_foo.res".
- Add support for NVIM_PRG, again so that all test-related targets are
consistent.
- Use consistent name for NVIM_PRG. But still need to support NVIM_PROG
for QuickBuild CI.
Note: The `oldtest` target is driven by the top-level Makefile, because
it requires a TTY. CMake 3.2 added a USES_TERMINAL flag to
add_custom_target(). But we support CMake 2.8...
add_custom_target(oldtest
COMMAND make clean
COMMAND make NVIM_PRG=$<TARGET_FILE:nvim> $ENV{MAKEOVERRIDES}
DEPENDS nvim
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir"
USES_TERMINAL true
)
45 lines
1.3 KiB
CMake
45 lines
1.3 KiB
CMake
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
|
|
set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
|
|
set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
|
|
set(ENV{XDG_DATA_HOME} ${WORKING_DIR}/Xtest_xdg/share)
|
|
|
|
if(NVIM_PRG)
|
|
set(ENV{NVIM_PRG} "${NVIM_PRG}")
|
|
endif()
|
|
|
|
if(DEFINED ENV{TEST_FILE})
|
|
set(TEST_PATH "$ENV{TEST_FILE}")
|
|
else()
|
|
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
|
|
endif()
|
|
|
|
if(BUSTED_OUTPUT_TYPE STREQUAL junit)
|
|
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
|
endif()
|
|
|
|
if(DEFINED ENV{TEST_TAG})
|
|
set(TEST_TAG "--tags=$ENV{TEST_TAG}")
|
|
endif()
|
|
|
|
if(DEFINED ENV{TEST_FILTER})
|
|
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
|
|
endif()
|
|
|
|
set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
|
|
execute_process(
|
|
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
|
--lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
|
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
|
|
WORKING_DIRECTORY ${WORKING_DIR}
|
|
ERROR_VARIABLE err
|
|
RESULT_VARIABLE res
|
|
${EXTRA_ARGS})
|
|
|
|
file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
|
|
file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
|
|
|
|
if(NOT res EQUAL 0)
|
|
message(STATUS "Output to stderr:\n${err}")
|
|
message(FATAL_ERROR "Running ${TEST_TYPE} tests failed with error: ${res}.")
|
|
endif()
|