@@ -104,10 +104,12 @@ endmacro()
104104#------------------------
105105macro (GtestIntegrationTestFiles integration_tests_source_dir prefix )
106106 file (GLOB ${prefix} _INTEGRATION_TESTS_INCLUDE_FILES ${integration_tests_source_dir} /*.hpp )
107+ file (GLOB ${prefix} _INTEGRATION_TESTS_CCM_INCLUDE_FILES ${integration_tests_source_dir} /ccm/*.hpp )
107108 file (GLOB ${prefix} _INTEGRATION_TESTS_OBJECTS_INCLUDE_FILES ${integration_tests_source_dir} /objects/*.hpp )
108109 file (GLOB ${prefix} _INTEGRATION_TESTS_POLICIES_INCLUDE_FILES ${integration_tests_source_dir} /policies/*.hpp )
109110 file (GLOB ${prefix} _INTEGRATION_TESTS_VALUES_INCLUDE_FILES ${integration_tests_source_dir} /values/*.hpp )
110111 file (GLOB ${prefix} _INTEGRATION_TESTS_SOURCE_FILES ${integration_tests_source_dir} /*.cpp )
112+ file (GLOB ${prefix} _INTEGRATION_TESTS_CCM_SOURCE_FILES ${integration_tests_source_dir} /ccm/*.cpp )
111113 file (GLOB ${prefix} _INTEGRATION_TESTS_OBJECTS_SOURCE_FILES ${integration_tests_source_dir} /objects/*.cpp )
112114 file (GLOB ${prefix} _INTEGRATION_TESTS_TESTS_SOURCE_FILES ${integration_tests_source_dir} /tests/*.cpp )
113115endmacro ()
@@ -123,10 +125,12 @@ endmacro()
123125#------------------------
124126macro (GtestIntegrationTestSourceGroups )
125127 source_group ("Header Files" FILES ${INTEGRATION_TESTS_INCLUDE_FILES} )
128+ source_group ("Header Files\\ ccm" FILES ${INTEGRATION_TESTS_CCM_INCLUDE_FILES} )
126129 source_group ("Header Files\\ objects" FILES ${INTEGRATION_TESTS_OBJECTS_INCLUDE_FILES} )
127130 source_group ("Header Files\\ policies" FILES ${INTEGRATION_TESTS_POLICIES_INCLUDE_FILES} )
128131 source_group ("Header Files\\ values" FILES ${INTEGRATION_TESTS_VALUES_INCLUDE_FILES} )
129132 source_group ("Source Files" FILES ${INTEGRATION_TESTS_SOURCE_FILES} )
133+ source_group ("Source Files\\ ccm" FILES ${INTEGRATION_TESTS_CCM_SOURCE_FILES} )
130134 source_group ("Source Files\\ objects" FILES ${INTEGRATION_TESTS_OBJECTS_SOURCE_FILES} )
131135 source_group ("Source Files\\ tests" FILES ${INTEGRATION_TESTS_TESTS_SOURCE_FILES} )
132136endmacro ()
@@ -138,10 +142,11 @@ endmacro()
138142# the project.
139143#
140144# Input: many
141- # Output: COMMON_INTEGRATION_TEST_SOURCE_FILES
145+ # Output: COMMON_INTEGRATION_TEST_INCLUDE_FILES, COMMON_INTEGRATION_TEST_SOURCE_FILES
142146#------------------------
143147macro (GtestCommonIntegrationTestSourceFiles )
144148 set (COMMON_INTEGRATION_TEST_INCLUDE_FILES ${INTEGRATION_TESTS_INCLUDE_FILES}
149+ ${INTEGRATION_TESTS_CCM_INCLUDE_FILES}
145150 ${INTEGRATION_TESTS_OBJECTS_INCLUDE_FILES}
146151 ${INTEGRATION_TESTS_POLICIES_INCLUDE_FILES}
147152 ${INTEGRATION_TESTS_VALUES_INCLUDE_FILES}
@@ -150,18 +155,75 @@ macro(GtestCommonIntegrationTestSourceFiles)
150155 ${CPP_DRIVER_INCLUDE_FILES}
151156 ${CPP_DRIVER_HEADER_SOURCE_FILES}
152157 ${CPP_DRIVER_HEADER_SOURCE_ATOMIC_FILES}
153- ${CCM_BRIDGE_HEADER_FILES}
154158 ${GOOGLE_TEST_HEADER_FILES}
155159 ${LIBUV_INCLUDE_FILES}
156160 ${LIBSSH2_INCLUDE_FILES}
157161 ${OPENSSL_INCLUDE_FILES} )
158162 set (COMMON_INTEGRATION_TEST_SOURCE_FILES ${INTEGRATION_TESTS_SOURCE_FILES}
163+ ${INTEGRATION_TESTS_CCM_SOURCE_FILES}
159164 ${INTEGRATION_TESTS_OBJECTS_SOURCE_FILES}
160165 ${INTEGRATION_TESTS_TESTS_SOURCE_FILES}
161166 ${CPP_DRIVER_SOURCE_FILES}
162167 ${GOOGLE_TEST_SOURCE_FILES} )
163168endmacro ()
164169
170+ #------------------------
171+ # GtestLibssh2IntegrationTest
172+ #
173+ # Determine if libssh2 has been requested.
174+ #
175+ # Input: CASS_USE_LIBSSH2
176+ # Output: INTEGRATION_TESTS_LIBSSH2_INCLUDE_FILES, INTEGRATION_TESTS_LIBSSH2_LIBRARIES
177+ #------------------------
178+ macro (GtestLibssh2IntegrationTest )
179+ if (CASS_USE_LIBSSH2)
180+ # Allow for libssh2 directory to be specified on the command line
181+ if (NOT LIBSSH2_ROOT)
182+ if (EXISTS "${PROJECT_SOURCE_DIR} /lib/libssh2/" )
183+ set (LIBSSH2_ROOT "${PROJECT_SOURCE_DIR} /lib/libssh2/" )
184+ elseif (EXISTS "${PROJECT_SOURCE_DIR} /build/libs/libssh2/" )
185+ set (LIBSSH2_ROOT "${PROJECT_SOURCE_DIR} /build/libs/libssh2/" )
186+ elseif (DEFINED ENV{LIBSSH2_ROOT} AND
187+ EXISTS "$ENV{LIBSSH2_ROOT} " )
188+ set (LIBSSH2_ROOT "$ENV{LIBSSH2_ROOT} " )
189+ endif ()
190+ endif ()
191+ if (LIBSSH2_ROOT_DIR)
192+ if (EXISTS ${LIBSSH2_ROOT_DIR} )
193+ set (LIBSSH2_ROOT ${LIBSSH2_ROOT_DIR} )
194+ endif ()
195+ endif ()
196+
197+ # Check for libssh2 availability (build if necessary on Windows)
198+ if (WIN32 AND LIBSSH2_VERSION) # Store the current version of libssh2 to prevent corruption
199+ set (SAVED_LIBSSH2_VERSION ${LIBSSH2_VERSION} )
200+ endif ()
201+ find_package (Libssh2 )
202+ if (WIN32 AND NOT LIBSSH2_FOUND)
203+ message (STATUS "Unable to Locate libssh2: Third party build step will be performed" )
204+ if (SAVED_LIBSSH2_VERSION)
205+ set (LIBSSH2_VERSION ${SAVED_LIBSSH2_VERSION} )
206+ endif ()
207+ include (ExternalProject-libssh2 )
208+ elseif (NOT LIBSSH2_FOUND)
209+ message (STATUS "libssh2 is Unavailable: Building integration tests without libssh2 support" )
210+ endif ()
211+ endif ()
212+ if (LIBSSH2_FOUND OR LIBSSH2_INCLUDE_DIRS)
213+ include_directories (${LIBSSH2_INCLUDE_DIRS} )
214+ set (INTEGRATION_TESTS_LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARIES} )
215+ # Build up the includes and libraries for CCM dependencies
216+ add_definitions (-DCASS_USE_LIBSSH2 -DOPENSSL_CLEANUP )
217+ file (GLOB INTEGRATION_TESTS_LIBSSH2_INCLUDE_FILES ${LIBSSH2_INCLUDE_DIRS} /*.h )
218+ source_group ("Header Files\\ libssh2" FILES ${INTEGRATION_TESTS_LIBSSH2_INCLUDE_FILES} )
219+
220+ if (WIN32 )
221+ add_definitions (-D_WINSOCK_DEPRECATED_NO_WARNINGS )
222+ set (INTEGRATION_TESTS_LIBSSH2_LIBRARIES ${INTEGRATION_TESTS_LIBSSH2_LIBRARIES} wsock32 ws2_32)
223+ endif ()
224+ endif ()
225+ endmacro ()
226+
165227#------------------------
166228# GtestUnitTests
167229#
@@ -182,11 +244,11 @@ macro(GtestUnitTests project_name extra_files extra_includes excluded_test_files
182244
183245 # The unit tests use `test::Utils::msleep()` and this is the minimum include
184246 # and source files required to shared that code.
185- set (INTEGRATION_TESTS_SOURCE_DIR ${CASS_ROOT_DIR} /gtests /src/integration)
186- set (CCM_BRIDGE_SOURCE_DIR ${CASS_ROOT_DIR} /test/ccm_bridge/src )
247+ set (INTEGRATION_TESTS_SOURCE_DIR ${CASS_ROOT_DIR} /tests /src/integration)
248+ set (INTEGRATION_TESTS_CCM_SOURCE_DIR ${INTEGRATION_TESTS_SOURCE_DIR} /ccm )
187249 set (INTEGRATION_TESTS_SOURCE_FILES ${INTEGRATION_TESTS_SOURCE_DIR} /test_utils.cpp
188250 ${INTEGRATION_TESTS_SOURCE_DIR} /driver_utils.cpp)
189- set (CCM_BRIDGE_SOURCE_FILES "${CCM_BRIDGE_SOURCE_DIR } /tsocket.cpp" )
251+ set (INTEGRATION_TESTS_CCM_SOURCE_FILES "${INTEGRATION_TESTS_CCM_SOURCE_DIR } /tsocket.cpp" )
190252 file (GLOB UNIT_TESTS_INCLUDE_FILES ${UNIT_TESTS_SOURCE_DIR} /*.hpp )
191253 file (GLOB UNIT_TESTS_SOURCE_FILES ${UNIT_TESTS_SOURCE_DIR} /*.cpp )
192254 file (GLOB UNIT_TESTS_TESTS_SOURCE_FILES ${UNIT_TESTS_SOURCE_DIR} /tests/*.cpp )
@@ -203,7 +265,7 @@ macro(GtestUnitTests project_name extra_files extra_includes excluded_test_files
203265 ${UNIT_TESTS_SOURCE_FILES}
204266 ${UNIT_TESTS_TESTS_SOURCE_FILES}
205267 ${INTEGRATION_TESTS_SOURCE_FILES}
206- ${CCM_BRIDGE_SOURCE_FILES }
268+ ${INTEGRATION_TESTS_CCM_SOURCE_FILES }
207269 ${CPP_DRIVER_SOURCE_FILES}
208270 ${UNIT_TESTS_INCLUDE_FILES}
209271 ${CASS_API_HEADER_FILES}
@@ -216,13 +278,13 @@ macro(GtestUnitTests project_name extra_files extra_includes excluded_test_files
216278 include_directories (${extra_includes}
217279 ${UNIT_TESTS_SOURCE_DIR}
218280 ${INTEGRATION_TESTS_SOURCE_DIR}
219- ${CCM_BRIDGE_SOURCE_DIR } )
281+ ${INTEGRATION_TESTS_CCM_SOURCE_DIR } )
220282 else ()
221283 target_include_directories (${UNIT_TESTS_NAME}
222284 PUBLIC ${extra_includes}
223285 ${UNIT_TESTS_SOURCE_DIR}
224286 ${INTEGRATION_TESTS_SOURCE_DIR}
225- ${CCM_BRIDGE_SOURCE_DIR } )
287+ ${INTEGRATION_TESTS_CCM_SOURCE_DIR } )
226288 endif ()
227289 target_link_libraries (${UNIT_TESTS_NAME}
228290 ${DSE_LIBS}
0 commit comments