GoogleTest.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. enable_language(CXX)
  2. include(GoogleTest)
  3. enable_testing()
  4. include(xcode_sign_adhoc.cmake)
  5. add_executable(fake_gtest fake_gtest.cpp)
  6. xcode_sign_adhoc(fake_gtest)
  7. gtest_discover_tests(
  8. fake_gtest
  9. TEST_PREFIX TEST:
  10. TEST_SUFFIX !1
  11. EXTRA_ARGS how now "\"brown\" cow"
  12. PROPERTIES LABELS TEST1
  13. )
  14. gtest_discover_tests(
  15. fake_gtest
  16. TEST_PREFIX TEST:
  17. TEST_SUFFIX !2
  18. EXTRA_ARGS how now "\"brown\" cow"
  19. PROPERTIES LABELS TEST2
  20. )
  21. gtest_discover_tests(
  22. fake_gtest
  23. TEST_PREFIX TEST:
  24. TEST_SUFFIX !3
  25. TEST_FILTER basic*
  26. EXTRA_ARGS how now "\"brown\" cow"
  27. PROPERTIES LABELS TEST3
  28. )
  29. gtest_discover_tests(
  30. fake_gtest
  31. TEST_PREFIX TEST:
  32. TEST_SUFFIX !4
  33. TEST_FILTER typed*
  34. EXTRA_ARGS how now "\"brown\" cow"
  35. PROPERTIES LABELS TEST4
  36. )
  37. gtest_discover_tests(
  38. fake_gtest
  39. TEST_PREFIX TEST:
  40. TEST_SUFFIX !5
  41. TEST_FILTER value*
  42. EXTRA_ARGS how now "\"brown\" cow"
  43. PROPERTIES LABELS TEST5
  44. NO_PRETTY_VALUES
  45. )
  46. gtest_discover_tests(
  47. fake_gtest
  48. TEST_PREFIX TEST:
  49. TEST_SUFFIX !6
  50. TEST_FILTER typed*
  51. EXTRA_ARGS how now "\"brown\" cow"
  52. PROPERTIES LABELS TEST6
  53. NO_PRETTY_TYPES
  54. )
  55. gtest_discover_tests(
  56. fake_gtest
  57. TEST_PREFIX TEST:
  58. TEST_SUFFIX !7
  59. TEST_FILTER dynamic*
  60. EXTRA_ARGS how now "\"brown\" cow"
  61. PROPERTIES LABELS TEST7
  62. NO_PRETTY_VALUES
  63. NO_PRETTY_TYPES
  64. )
  65. add_executable(no_tests_defined no_tests_defined.cpp)
  66. xcode_sign_adhoc(no_tests_defined)
  67. gtest_discover_tests(
  68. no_tests_defined
  69. )
  70. # Note change in behavior of TIMEOUT keyword in 3.10.3
  71. # where it was renamed to DISCOVERY_TIMEOUT to prevent it
  72. # from shadowing the TIMEOUT test property. Verify the
  73. # 3.10.3 and later behavior, old behavior added in 3.10.1
  74. # is not supported.
  75. add_executable(property_timeout_test timeout_test.cpp)
  76. xcode_sign_adhoc(property_timeout_test)
  77. target_compile_definitions(property_timeout_test PRIVATE sleepSec=10)
  78. gtest_discover_tests(
  79. property_timeout_test
  80. TEST_PREFIX property_
  81. TEST_SUFFIX _no_discovery
  82. PROPERTIES TIMEOUT 2
  83. )
  84. gtest_discover_tests(
  85. property_timeout_test
  86. TEST_PREFIX property_
  87. TEST_SUFFIX _with_discovery
  88. DISCOVERY_TIMEOUT 20
  89. PROPERTIES TIMEOUT 2
  90. )
  91. add_executable(skip_test skip_test.cpp)
  92. xcode_sign_adhoc(skip_test)
  93. gtest_discover_tests(
  94. skip_test
  95. )
  96. gtest_add_tests(
  97. TARGET skip_test
  98. )