@@ -79,3 +79,72 @@ foreach(test ${tests})
79
79
endif ()
80
80
doctest_discover_tests(${test_name} TEST_PREFIX ${test_prefix} - PROPERTIES TIMEOUT ${${test_name} _TIMEOUT})
81
81
endforeach ()
82
+
83
+ function (add_usage_test variant_name cppcoro_ROOT)
84
+ set (APP_BINARY_DIR ${CPPCORO_USAGE_TEST_DIR} /app_build/${variant_name} )
85
+ add_test (
86
+ NAME app_configure_${variant_name}
87
+ COMMAND
88
+ ${CMAKE_COMMAND}
89
+ -S ${CMAKE_CURRENT_LIST_DIR} /use_cppcoro
90
+ -B ${APP_BINARY_DIR}
91
+ -G ${CMAKE_GENERATOR}
92
+ -D CMAKE_BUILD_TYPE =${CMAKE_BUILD_TYPE}
93
+ -D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
94
+ -D CMAKE_CXX_FLAGS =${CMAKE_CXX_FLAGS}
95
+ -D cppcoro_ROOT=${cppcoro_ROOT}
96
+ )
97
+ add_test (
98
+ NAME app_build_${variant_name}
99
+ COMMAND
100
+ ${CMAKE_COMMAND}
101
+ --build ${APP_BINARY_DIR}
102
+ --config ${CMAKE_BUILD_TYPE}
103
+ )
104
+ set_tests_properties (
105
+ app_configure_${variant_name}
106
+ PROPERTIES
107
+ FIXTURES_SETUP app_build_${variant_name} _requires
108
+ TIMEOUT 30
109
+ )
110
+ set_tests_properties (
111
+ app_build_${variant_name}
112
+ PROPERTIES
113
+ FIXTURES_REQUIRED app_build_${variant_name} _requires
114
+ TIMEOUT 30
115
+ )
116
+ endfunction ()
117
+
118
+ if (CPPCORO_USAGE_TEST_DIR)
119
+ if (NOT IS_ABSOLUTE ${CPPCORO_USAGE_TEST_DIR} )
120
+ set (CPPCORO_USAGE_TEST_DIR ${PROJECT_BINARY_DIR} /${CPPCORO_USAGE_TEST_DIR} )
121
+ endif ()
122
+
123
+ add_usage_test(with_cppcoro_build_tree ${PROJECT_BINARY_DIR} )
124
+
125
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
126
+ set (CPPCORO_USAGE_TEST_INSTALL_DIR ${CPPCORO_USAGE_TEST_DIR} /cppcoro_install)
127
+
128
+ add_usage_test(with_cppcoro_install_dir ${CPPCORO_USAGE_TEST_INSTALL_DIR} )
129
+
130
+ add_test (
131
+ NAME cppcoro_usage_test_install
132
+ COMMAND
133
+ ${CMAKE_COMMAND}
134
+ --install ${PROJECT_BINARY_DIR}
135
+ --config ${CMAKE_BUILD_TYPE}
136
+ --prefix ${CPPCORO_USAGE_TEST_INSTALL_DIR}
137
+ )
138
+ set_tests_properties (
139
+ cppcoro_usage_test_install
140
+ PROPERTIES
141
+ FIXTURES_SETUP app_configure_with_cppcoro_install_dir_requires
142
+ TIMEOUT 30
143
+ )
144
+ set_tests_properties (
145
+ app_configure_with_cppcoro_install_dir
146
+ PROPERTIES
147
+ FIXTURES_REQUIRED app_configure_with_cppcoro_install_dir_requires
148
+ )
149
+ endif ()
150
+ endif ()
0 commit comments