2023-02-08 15:46:39 -07:00
|
|
|
add_subdirectory(functional/fixtures) # compile test programs
|
|
|
|
|
2023-04-26 23:36:37 -07:00
|
|
|
get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
|
2023-02-08 15:46:39 -07:00
|
|
|
|
2023-11-24 05:28:15 -07:00
|
|
|
set(TEST_OPTIONS
|
|
|
|
-D BUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-D CIRRUS_CI=$ENV{CIRRUS_CI}
|
|
|
|
-D CI_BUILD=${CI_BUILD}
|
|
|
|
-D DEPS_INSTALL_DIR=${DEPS_INSTALL_DIR}
|
2024-01-19 05:21:25 -07:00
|
|
|
-D NVIM_PRG=$<TARGET_FILE:nvim_bin>
|
2023-11-24 05:28:15 -07:00
|
|
|
-D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-D WORKING_DIR=${PROJECT_SOURCE_DIR})
|
2023-02-08 15:46:39 -07:00
|
|
|
|
2023-04-26 23:36:37 -07:00
|
|
|
check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
|
|
|
|
if(LUA_HAS_FFI)
|
|
|
|
add_custom_target(unittest
|
2023-02-08 15:46:39 -07:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2023-04-26 23:36:37 -07:00
|
|
|
-D TEST_TYPE=unit
|
2023-11-24 05:28:15 -07:00
|
|
|
${TEST_OPTIONS}
|
2023-02-08 15:46:39 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
|
|
|
USES_TERMINAL)
|
2024-01-19 05:21:25 -07:00
|
|
|
add_dependencies(unittest lua-dev-deps nvim)
|
2023-04-26 23:36:37 -07:00
|
|
|
else()
|
|
|
|
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
|
2023-02-08 15:46:39 -07:00
|
|
|
endif()
|
|
|
|
|
2023-04-26 23:36:37 -07:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
|
|
|
|
${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua)
|
|
|
|
|
|
|
|
add_custom_target(functionaltest
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-D TEST_TYPE=functional
|
2023-11-24 05:28:15 -07:00
|
|
|
${TEST_OPTIONS}
|
2023-04-26 23:36:37 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2024-01-19 05:21:25 -07:00
|
|
|
DEPENDS printenv-test printargs-test shell-test pwsh-test streams-test tty-test
|
2023-04-26 23:36:37 -07:00
|
|
|
USES_TERMINAL)
|
2024-01-19 05:21:25 -07:00
|
|
|
add_dependencies(functionaltest lua-dev-deps nvim)
|
2023-04-26 23:36:37 -07:00
|
|
|
|
|
|
|
add_custom_target(benchmark
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-D TEST_TYPE=benchmark
|
2023-11-24 05:28:15 -07:00
|
|
|
${TEST_OPTIONS}
|
2023-04-26 23:36:37 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2024-01-19 05:21:25 -07:00
|
|
|
DEPENDS tty-test
|
2023-04-26 23:36:37 -07:00
|
|
|
USES_TERMINAL)
|
2024-01-19 05:21:25 -07:00
|
|
|
add_dependencies(benchmark lua-dev-deps nvim)
|