CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. add_subdirectory(functional/fixtures) # compile test programs
  2. get_directory_property(GENERATED_HELP_TAGS DIRECTORY ${PROJECT_SOURCE_DIR}/runtime DEFINITION GENERATED_HELP_TAGS)
  3. get_directory_property(GENERATED_SYN_VIM DIRECTORY ${PROJECT_SOURCE_DIR}/runtime DEFINITION GENERATED_SYN_VIM)
  4. if(NOT BUSTED_OUTPUT_TYPE)
  5. set(BUSTED_OUTPUT_TYPE "nvim")
  6. endif()
  7. find_program(BUSTED_PRG NAMES busted busted.bat)
  8. if(BUSTED_PRG)
  9. get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES)
  10. set(UNITTEST_PREREQS nvim)
  11. set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test pwsh-test streams-test tty-test ${GENERATED_HELP_TAGS} ${GENERATED_SYN_VIM})
  12. set(BENCHMARK_PREREQS nvim tty-test)
  13. check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
  14. if(LUA_HAS_FFI)
  15. add_custom_target(unittest
  16. COMMAND ${CMAKE_COMMAND}
  17. -D BUSTED_PRG=${BUSTED_PRG}
  18. -D NVIM_PRG=$<TARGET_FILE:nvim>
  19. -D WORKING_DIR=${PROJECT_SOURCE_DIR}
  20. -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
  21. -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
  22. -D BUILD_DIR=${CMAKE_BINARY_DIR}
  23. -D TEST_TYPE=unit
  24. -D CIRRUS_CI=$ENV{CIRRUS_CI}
  25. -D CI_BUILD=${CI_BUILD}
  26. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  27. DEPENDS ${UNITTEST_PREREQS}
  28. USES_TERMINAL)
  29. else()
  30. message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
  31. endif()
  32. configure_file(
  33. ${CMAKE_SOURCE_DIR}/test/cmakeconfig/paths.lua.in
  34. ${CMAKE_BINARY_DIR}/test/cmakeconfig/paths.lua)
  35. add_custom_target(functionaltest
  36. COMMAND ${CMAKE_COMMAND}
  37. -D BUSTED_PRG=${BUSTED_PRG}
  38. -D NVIM_PRG=$<TARGET_FILE:nvim>
  39. -D WORKING_DIR=${PROJECT_SOURCE_DIR}
  40. -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
  41. -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
  42. -D BUILD_DIR=${CMAKE_BINARY_DIR}
  43. -D DEPS_PREFIX=${DEPS_PREFIX}
  44. -D TEST_TYPE=functional
  45. -D CIRRUS_CI=$ENV{CIRRUS_CI}
  46. -D CI_BUILD=${CI_BUILD}
  47. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  48. DEPENDS ${FUNCTIONALTEST_PREREQS}
  49. USES_TERMINAL)
  50. add_custom_target(benchmark
  51. COMMAND ${CMAKE_COMMAND}
  52. -D BUSTED_PRG=${BUSTED_PRG}
  53. -D NVIM_PRG=$<TARGET_FILE:nvim>
  54. -D WORKING_DIR=${PROJECT_SOURCE_DIR}
  55. -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
  56. -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
  57. -D BUILD_DIR=${CMAKE_BINARY_DIR}
  58. -D TEST_TYPE=benchmark
  59. -D CIRRUS_CI=$ENV{CIRRUS_CI}
  60. -D CI_BUILD=${CI_BUILD}
  61. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  62. DEPENDS ${BENCHMARK_PREREQS}
  63. USES_TERMINAL)
  64. endif()
  65. find_program(BUSTED_LUA_PRG busted-lua)
  66. if(BUSTED_LUA_PRG)
  67. add_custom_target(functionaltest-lua
  68. COMMAND ${CMAKE_COMMAND}
  69. -D BUSTED_PRG=${BUSTED_LUA_PRG}
  70. -D NVIM_PRG=$<TARGET_FILE:nvim>
  71. -D WORKING_DIR=${PROJECT_SOURCE_DIR}
  72. -D BUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
  73. -D TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
  74. -D BUILD_DIR=${CMAKE_BINARY_DIR}
  75. -D TEST_TYPE=functional
  76. -D CIRRUS_CI=$ENV{CIRRUS_CI}
  77. -D CI_BUILD=${CI_BUILD}
  78. -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
  79. DEPENDS ${FUNCTIONALTEST_PREREQS}
  80. USES_TERMINAL)
  81. endif()