GoogleTest.cmake 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. gtest_discover_tests(
  66. fake_gtest
  67. TEST_PREFIX TEST:
  68. TEST_SUFFIX !8
  69. TEST_FILTER notests*
  70. EXTRA_ARGS how now "\"brown\" cow"
  71. PROPERTIES LABELS TEST8
  72. )
  73. add_executable(no_tests_defined no_tests_defined.cpp)
  74. xcode_sign_adhoc(no_tests_defined)
  75. gtest_discover_tests(
  76. no_tests_defined
  77. )
  78. # Note change in behavior of TIMEOUT keyword in 3.10.3
  79. # where it was renamed to DISCOVERY_TIMEOUT to prevent it
  80. # from shadowing the TIMEOUT test property. Verify the
  81. # 3.10.3 and later behavior, old behavior added in 3.10.1
  82. # is not supported.
  83. add_executable(property_timeout_test timeout_test.cpp)
  84. xcode_sign_adhoc(property_timeout_test)
  85. target_compile_definitions(property_timeout_test PRIVATE sleepSec=10)
  86. gtest_discover_tests(
  87. property_timeout_test
  88. TEST_PREFIX property_
  89. TEST_SUFFIX _no_discovery
  90. PROPERTIES TIMEOUT 2
  91. )
  92. gtest_discover_tests(
  93. property_timeout_test
  94. TEST_PREFIX property_
  95. TEST_SUFFIX _with_discovery
  96. DISCOVERY_TIMEOUT 20
  97. PROPERTIES TIMEOUT 2
  98. )
  99. add_executable(skip_test skip_test.cpp)
  100. xcode_sign_adhoc(skip_test)
  101. gtest_discover_tests(
  102. skip_test
  103. )
  104. gtest_add_tests(
  105. TARGET skip_test
  106. )