mirror of
https://github.com/neovim/neovim.git
synced 2024-12-21 03:35:02 -07:00
1ee7ca7bc0
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these environment variables will pass --tags/--filter to busted, which can used to filter which tests are executed. - Remove calls to nvim msgpack-rpc API outside tests. This removes the requirement of having a static `clear` call in test/functional/helpers.lua - Use the new busted command-line option "--lazy" to ensure the setup/teardown hooks are only executed when a suite runs at least one test. Now its possible to run/debug a single test like this: ```sh TEST_FILTER='some test string' make test ``` Which will only run tests containing "some test string" in the title. Another option is: ```sh TEST_TAG=some-tag make test ``` After putting #some-tag into the test title. This also improves debugging experience because there will be no unnecessary gdbserver instances whe GDB=1 is passed.
41 lines
1.0 KiB
CMake
41 lines
1.0 KiB
CMake
get_filename_component(BUSTED_DIR ${BUSTED_PRG} PATH)
|
|
set(ENV{PATH} "${BUSTED_DIR}:$ENV{PATH}")
|
|
|
|
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
|
|
|
|
if(NVIM_PRG)
|
|
set(ENV{NVIM_PROG} "${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()
|
|
|
|
execute_process(
|
|
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
|
--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})
|
|
|
|
if(NOT res EQUAL 0)
|
|
message(STATUS "Output to stderr:\n${err}")
|
|
message(FATAL_ERROR "Running ${TEST_TYPE} tests failed with error: ${res}.")
|
|
endif()
|