@@ -60,3 +60,72 @@ foreach(test ${tests})
60
60
endif ()
61
61
doctest_discover_tests(${test_name} TEST_PREFIX ${test_prefix} - PROPERTIES TIMEOUT ${${test_name} _TIMEOUT})
62
62
endforeach ()
63
+
64
+ function (add_usage_test variant_name cppcoro_ROOT)
65
+ set (APP_BINARY_DIR ${CPPCORO_USAGE_TEST_DIR} /app_build/${variant_name} )
66
+ add_test (
67
+ NAME app_configure_${variant_name}
68
+ COMMAND
69
+ ${CMAKE_COMMAND}
70
+ -S ${CMAKE_CURRENT_LIST_DIR} /use_cppcoro
71
+ -B ${APP_BINARY_DIR}
72
+ -G ${CMAKE_GENERATOR}
73
+ -D CMAKE_BUILD_TYPE =${CMAKE_BUILD_TYPE}
74
+ -D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
75
+ -D CMAKE_CXX_FLAGS =${CMAKE_CXX_FLAGS}
76
+ -D cppcoro_ROOT=${cppcoro_ROOT}
77
+ )
78
+ add_test (
79
+ NAME app_build_${variant_name}
80
+ COMMAND
81
+ ${CMAKE_COMMAND}
82
+ --build ${APP_BINARY_DIR}
83
+ --config ${CMAKE_BUILD_TYPE}
84
+ )
85
+ set_tests_properties (
86
+ app_configure_${variant_name}
87
+ PROPERTIES
88
+ FIXTURES_SETUP app_build_${variant_name} _requires
89
+ TIMEOUT 30
90
+ )
91
+ set_tests_properties (
92
+ app_build_${variant_name}
93
+ PROPERTIES
94
+ FIXTURES_REQUIRED app_build_${variant_name} _requires
95
+ TIMEOUT 30
96
+ )
97
+ endfunction ()
98
+
99
+ if (CPPCORO_USAGE_TEST_DIR)
100
+ if (NOT IS_ABSOLUTE ${CPPCORO_USAGE_TEST_DIR} )
101
+ set (CPPCORO_USAGE_TEST_DIR ${PROJECT_BINARY_DIR} /${CPPCORO_USAGE_TEST_DIR} )
102
+ endif ()
103
+
104
+ add_usage_test(with_cppcoro_build_tree ${PROJECT_BINARY_DIR} )
105
+
106
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
107
+ set (CPPCORO_USAGE_TEST_INSTALL_DIR ${CPPCORO_USAGE_TEST_DIR} /cppcoro_install)
108
+
109
+ add_usage_test(with_cppcoro_install_dir ${CPPCORO_USAGE_TEST_INSTALL_DIR} )
110
+
111
+ add_test (
112
+ NAME cppcoro_usage_test_install
113
+ COMMAND
114
+ ${CMAKE_COMMAND}
115
+ --install ${PROJECT_BINARY_DIR}
116
+ --config ${CMAKE_BUILD_TYPE}
117
+ --prefix ${CPPCORO_USAGE_TEST_INSTALL_DIR}
118
+ )
119
+ set_tests_properties (
120
+ cppcoro_usage_test_install
121
+ PROPERTIES
122
+ FIXTURES_SETUP app_configure_with_cppcoro_install_dir_requires
123
+ TIMEOUT 30
124
+ )
125
+ set_tests_properties (
126
+ app_configure_with_cppcoro_install_dir
127
+ PROPERTIES
128
+ FIXTURES_REQUIRED app_configure_with_cppcoro_install_dir_requires
129
+ )
130
+ endif ()
131
+ endif ()
0 commit comments