CMakeLists.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. add_subdirectory(functional/fixtures) # compile test programs
  2. get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
  3. set(TEST_OPTIONS
  4. -D BUILD_DIR=${CMAKE_BINARY_DIR}
  5. -D CIRRUS_CI=$ENV{CIRRUS_CI}
  6. -D CI_BUILD=${CI_BUILD}
  7. -D DEPS_INSTALL_DIR=${DEPS_INSTALL_DIR}
  8. -D NVIM_PRG=$<TARGET_FILE:nvim_bin>
  9. -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
  10. -D WORKING_DIR=${PROJECT_SOURCE_DIR})
  11. check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
  12. if(LUA_HAS_FFI)
  13. add_custom_target(unittest
  14. COMMAND ${CMAKE_COMMAND}
  15. -D TEST_TYPE=unit
  16. ${TEST_OPTIONS}
  17. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  18. USES_TERMINAL)
  19. add_dependencies(unittest lua_dev_deps nvim)
  20. else()
  21. message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
  22. endif()
  23. configure_file(
  24. ${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
  25. ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua)
  26. add_custom_target(functionaltest
  27. COMMAND ${CMAKE_COMMAND}
  28. -D TEST_TYPE=functional
  29. ${TEST_OPTIONS}
  30. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  31. DEPENDS printenv-test printargs-test shell-test pwsh-test streams-test tty-test
  32. USES_TERMINAL)
  33. add_dependencies(functionaltest lua_dev_deps nvim)
  34. add_custom_target(benchmark
  35. COMMAND ${CMAKE_COMMAND}
  36. -D TEST_TYPE=benchmark
  37. ${TEST_OPTIONS}
  38. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  39. DEPENDS tty-test
  40. USES_TERMINAL)
  41. add_dependencies(benchmark lua_dev_deps nvim)