RunCMakeTest.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. include(RunCMake)
  2. function(run_GoogleTest)
  3. # Use a single build tree for a few tests without cleaning.
  4. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build)
  5. set(RunCMake_TEST_NO_CLEAN 1)
  6. if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
  7. set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
  8. endif()
  9. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  10. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  11. run_cmake(GoogleTest)
  12. run_cmake_command(GoogleTest-build
  13. ${CMAKE_COMMAND}
  14. --build .
  15. --config Debug
  16. --target fake_gtest
  17. )
  18. run_cmake_command(GoogleTest-property-timeout-exe
  19. ${CMAKE_COMMAND}
  20. --build .
  21. --config Debug
  22. --target property_timeout_test
  23. )
  24. set(RunCMake_TEST_OUTPUT_MERGE 1)
  25. run_cmake_command(GoogleTest-discovery-timeout
  26. ${CMAKE_COMMAND}
  27. --build .
  28. --config Debug
  29. --target discovery_timeout_test
  30. )
  31. set(RunCMake_TEST_OUTPUT_MERGE 0)
  32. run_cmake_command(GoogleTest-test1
  33. ${CMAKE_CTEST_COMMAND}
  34. -C Debug
  35. -L TEST1
  36. --no-label-summary
  37. )
  38. run_cmake_command(GoogleTest-test2
  39. ${CMAKE_CTEST_COMMAND}
  40. -C Debug
  41. -L TEST2
  42. --no-label-summary
  43. )
  44. run_cmake_command(GoogleTest-test-missing
  45. ${CMAKE_CTEST_COMMAND}
  46. -C Debug
  47. -R no_tests_defined
  48. --no-label-summary
  49. )
  50. run_cmake_command(GoogleTest-property-timeout1
  51. ${CMAKE_CTEST_COMMAND}
  52. -C Debug
  53. -R property_timeout\\.case_no_discovery
  54. --no-label-summary
  55. )
  56. run_cmake_command(GoogleTest-property-timeout2
  57. ${CMAKE_CTEST_COMMAND}
  58. -C Debug
  59. -R property_timeout\\.case_with_discovery
  60. --no-label-summary
  61. )
  62. endfunction()
  63. run_GoogleTest()