RunTests.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Set LC_ALL to meet expectations of some locale-sensitive tests.
  2. set(ENV{LC_ALL} "en_US.UTF-8")
  3. set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
  4. set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
  5. set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
  6. set(ENV{XDG_DATA_HOME} ${WORKING_DIR}/Xtest_xdg/share)
  7. if(NOT DEFINED ENV{NVIM_LOG_FILE})
  8. set(ENV{NVIM_LOG_FILE} ${WORKING_DIR}/.nvimlog)
  9. endif()
  10. if(NVIM_PRG)
  11. set(ENV{NVIM_PRG} "${NVIM_PRG}")
  12. endif()
  13. if(DEFINED ENV{TEST_FILE})
  14. set(TEST_PATH "$ENV{TEST_FILE}")
  15. else()
  16. set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
  17. endif()
  18. if(BUSTED_OUTPUT_TYPE STREQUAL junit)
  19. set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
  20. endif()
  21. if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
  22. set(TEST_TAG "--tags=$ENV{TEST_TAG}")
  23. endif()
  24. if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
  25. set(TEST_FILTER "--filter=$ENV{TEST_FILTER}")
  26. endif()
  27. execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${WORKING_DIR}/Xtest-tmpdir)
  28. set(ENV{TMPDIR} ${WORKING_DIR}/Xtest-tmpdir)
  29. set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
  30. execute_process(
  31. COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
  32. --lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
  33. --lpath=${BUILD_DIR}/?.lua
  34. --lpath=${WORKING_DIR}/runtime/lua/?.lua
  35. --lpath=?.lua
  36. ${TEST_PATH}
  37. WORKING_DIRECTORY ${WORKING_DIR}
  38. ERROR_VARIABLE err
  39. RESULT_VARIABLE res
  40. ${EXTRA_ARGS})
  41. file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
  42. file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
  43. file(REMOVE_RECURSE ${WORKING_DIR}/Xtest-tmpdir)
  44. if(NOT res EQUAL 0)
  45. message(STATUS "Output to stderr:\n${err}")
  46. message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
  47. endif()