1515# specific language governing permissions and limitations
1616# under the License.
1717
18- fetchcontent_declare(cpp-httplib
19- GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
20- GIT_TAG 89c932f313c6437c38f2982869beacc89c2f2246 #release-0.26.0
21- )
22-
2318fetchcontent_declare(googletest
2419 GIT_REPOSITORY https://github.com/google/googletest.git
2520 GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59 # release-1.15.2
2621 FIND_PACKAGE_ARGS
2722 NAMES
2823 GTest)
2924
30- if (ICEBERG_BUILD_REST)
31- fetchcontent_makeavailable(cpp-httplib googletest)
32- else ()
33- fetchcontent_makeavailable(googletest)
34- endif ()
25+ fetchcontent_makeavailable(googletest)
3526
3627set (ICEBERG_TEST_RESOURCES "${CMAKE_SOURCE_DIR} /src/iceberg/test/resources" )
3728
3829configure_file ("test_config.h.in" "test_config.h" )
3930
31+ add_subdirectory (util)
32+
4033function (add_iceberg_test test_name)
4134 set (options USE_BUNDLE)
4235 set (oneValueArgs)
@@ -53,11 +46,11 @@ function(add_iceberg_test test_name)
5346 target_sources (${test_name} PRIVATE ${ARG_SOURCES} )
5447
5548 if (ARG_USE_BUNDLE)
56- target_link_libraries (${test_name} PRIVATE iceberg_bundle_static GTest::gtest_main
57- GTest::gmock )
49+ target_link_libraries (${test_name} PRIVATE iceberg_bundle_static GTest::gmock_main
50+ iceberg_test_util )
5851 else ()
59- target_link_libraries (${test_name} PRIVATE iceberg_static GTest::gtest_main
60- GTest::gmock )
52+ target_link_libraries (${test_name} PRIVATE iceberg_static GTest::gmock_main
53+ iceberg_test_util )
6154 endif ()
6255
6356 add_test (NAME ${test_name} COMMAND ${test_name} )
@@ -85,8 +78,7 @@ add_iceberg_test(table_test
8578 table_test.cc
8679 table_metadata_builder_test.cc
8780 table_requirement_test.cc
88- table_update_test.cc
89- test_common.cc)
81+ table_update_test.cc)
9082
9183add_iceberg_test(expression_test
9284 SOURCES
@@ -98,7 +90,6 @@ add_iceberg_test(expression_test
9890
9991add_iceberg_test(json_serde_test
10092 SOURCES
101- test_common.cc
10293 json_internal_test.cc
10394 metadata_serde_test.cc
10495 schema_json_test.cc)
@@ -128,8 +119,7 @@ if(ICEBERG_BUILD_BUNDLE)
128119 manifest_list_reader_writer_test.cc
129120 manifest_list_versions_test.cc
130121 manifest_reader_writer_test.cc
131- manifest_writer_versions_test.cc
132- test_common.cc)
122+ manifest_writer_versions_test.cc)
133123
134124 add_iceberg_test(arrow_test
135125 USE_BUNDLE
@@ -140,18 +130,13 @@ if(ICEBERG_BUILD_BUNDLE)
140130 metadata_io_test.cc
141131 struct_like_test.cc)
142132
143- add_iceberg_test(catalog_test
144- USE_BUNDLE
145- SOURCES
146- test_common.cc
147- in_memory_catalog_test.cc)
133+ add_iceberg_test(catalog_test USE_BUNDLE SOURCES in_memory_catalog_test.cc)
148134
149135 add_iceberg_test(eval_expr_test
150136 USE_BUNDLE
151137 SOURCES
152138 eval_expr_test.cc
153- evaluator_test.cc
154- test_common.cc)
139+ evaluator_test.cc)
155140
156141 add_iceberg_test(parquet_test
157142 USE_BUNDLE
@@ -178,16 +163,15 @@ if(ICEBERG_BUILD_REST)
178163 add_executable (${test_name} )
179164 target_include_directories (${test_name} PRIVATE "${CMAKE_BINARY_DIR} /iceberg/test/" )
180165 target_sources (${test_name} PRIVATE ${ARG_SOURCES} )
181- target_link_libraries (${test_name} PRIVATE GTest::gtest_main GTest::gmock
182- iceberg_rest_static )
166+ target_link_libraries (${test_name} PRIVATE GTest::gmock_main iceberg_rest_static
167+ iceberg_test_util )
183168 add_test (NAME ${test_name} COMMAND ${test_name} )
184169 endfunction ()
185170
186- add_rest_iceberg_test(rest_catalog_test
187- SOURCES
188- rest_catalog_test.cc
189- rest_json_internal_test.cc
171+ add_rest_iceberg_test(rest_catalog_test SOURCES rest_json_internal_test.cc
190172 rest_util_test.cc)
191173
192- target_include_directories (rest_catalog_test PRIVATE ${cpp-httplib_SOURCE_DIR})
174+ if (ICEBERG_BUILD_REST_INTEGRATION_TESTS)
175+ add_rest_iceberg_test(rest_catalog_integration_test SOURCES rest_catalog_test.cc)
176+ endif ()
193177endif ()
0 commit comments