forked from apache/iceberg-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
313 lines (277 loc) · 11 KB
/
Copy pathCMakeLists.txt
File metadata and controls
313 lines (277 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set(CMAKE_COMPILE_WARNING_AS_ERROR FALSE)
set(INSTALL_GTEST
OFF
CACHE BOOL "" FORCE)
fetchcontent_declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59 # release-1.15.2
FIND_PACKAGE_ARGS
NAMES
GTest)
fetchcontent_makeavailable(googletest)
set(ICEBERG_TEST_RESOURCES "${CMAKE_SOURCE_DIR}/src/iceberg/test/resources")
configure_file("test_config.h.in" "test_config.h")
function(add_iceberg_test test_name)
set(options USE_BUNDLE USE_DATA)
set(oneValueArgs)
set(multiValueArgs SOURCES)
cmake_parse_arguments(ARG
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN})
add_executable(${test_name})
target_include_directories(${test_name} PRIVATE "${CMAKE_BINARY_DIR}/iceberg/test/")
target_sources(${test_name} PRIVATE ${ARG_SOURCES})
if(ARG_USE_BUNDLE)
target_link_libraries(${test_name}
PRIVATE "$<IF:$<TARGET_EXISTS:iceberg_bundle_static>,iceberg_bundle_static,iceberg_bundle_shared>"
GTest::gmock_main)
elseif(ARG_USE_DATA)
target_link_libraries(${test_name}
PRIVATE "$<IF:$<TARGET_EXISTS:iceberg_data_static>,iceberg_data_static,iceberg_data_shared>"
GTest::gmock_main)
else()
target_link_libraries(${test_name}
PRIVATE "$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>"
GTest::gmock_main)
endif()
if(MSVC_TOOLCHAIN)
target_compile_options(${test_name} PRIVATE /bigobj)
endif()
add_test(NAME ${test_name} COMMAND ${test_name})
endfunction()
add_iceberg_test(schema_test
SOURCES
assign_id_visitor_test.cc
name_mapping_test.cc
partition_field_test.cc
partition_spec_test.cc
partition_value_test.cc
schema_field_test.cc
schema_test.cc
schema_util_test.cc
sort_field_test.cc
sort_order_test.cc
transform_human_string_test.cc
transform_test.cc
type_test.cc)
add_iceberg_test(table_test
SOURCES
location_provider_test.cc
metadata_table_test.cc
metrics_config_test.cc
metrics_reporter_test.cc
metrics_test.cc
snapshot_summary_builder_test.cc
snapshot_test.cc
snapshot_util_test.cc
table_metadata_builder_test.cc
table_requirement_test.cc
table_requirements_test.cc
table_test.cc
table_update_test.cc)
add_iceberg_test(logging_test SOURCES log_level_test.cc logger_test.cc)
add_iceberg_test(expression_test
SOURCES
aggregate_test.cc
expression_json_test.cc
expression_test.cc
expression_visitor_test.cc
inclusive_metrics_evaluator_test.cc
inclusive_metrics_evaluator_with_transform_test.cc
literal_test.cc
manifest_evaluator_test.cc
predicate_test.cc
projections_test.cc
residual_evaluator_test.cc
strict_metrics_evaluator_test.cc)
add_iceberg_test(json_serde_test
SOURCES
json_serde_test.cc
metadata_serde_test.cc
schema_json_test.cc)
add_iceberg_test(util_test
USE_DATA
SOURCES
base64_test.cc
bucket_util_test.cc
config_test.cc
data_file_set_test.cc
decimal_test.cc
endian_test.cc
file_io_test.cc
formatter_test.cc
lazy_test.cc
location_util_test.cc
math_util_internal_test.cc
executor_util_test.cc
roaring_position_bitmap_test.cc
position_delete_index_test.cc
position_delete_range_consumer_test.cc
retry_util_test.cc
string_util_test.cc
struct_like_set_test.cc
task_group_test.cc
temporal_util_test.cc
transform_util_test.cc
truncate_util_test.cc
url_encoder_test.cc
uuid_test.cc
visit_type_test.cc)
add_iceberg_test(puffin_test
USE_DATA
SOURCES
puffin_format_test.cc
puffin_json_test.cc
puffin_reader_writer_test.cc)
if(ICEBERG_BUILD_BUNDLE)
add_iceberg_test(avro_test
USE_BUNDLE
SOURCES
avro_data_test.cc
avro_test.cc
avro_schema_test.cc
avro_stream_test.cc)
add_iceberg_test(arrow_test
USE_BUNDLE
SOURCES
arrow_io_test.cc
arrow_test.cc
gzip_decompress_test.cc
metadata_io_test.cc
struct_like_test.cc)
if(ICEBERG_S3)
add_iceberg_test(file_io_test USE_BUNDLE SOURCES arrow_s3_file_io_test.cc)
endif()
add_iceberg_test(catalog_test USE_BUNDLE SOURCES in_memory_catalog_test.cc)
add_iceberg_test(eval_expr_test
USE_BUNDLE
SOURCES
eval_expr_test.cc
evaluator_test.cc)
add_iceberg_test(manifest_test
USE_BUNDLE
SOURCES
delete_file_index_test.cc
manifest_group_test.cc
manifest_list_versions_test.cc
manifest_merge_manager_test.cc
manifest_reader_stats_test.cc
manifest_reader_test.cc
manifest_writer_versions_test.cc
rolling_manifest_writer_test.cc)
add_iceberg_test(parquet_test
USE_BUNDLE
SOURCES
metrics_test_base.cc
parquet_data_test.cc
parquet_metrics_test.cc
parquet_schema_test.cc
parquet_test.cc)
add_iceberg_test(scan_test
USE_BUNDLE
SOURCES
file_scan_task_test.cc
incremental_append_scan_test.cc
incremental_changelog_scan_test.cc
table_scan_test.cc)
add_iceberg_test(table_update_test
USE_BUNDLE
SOURCES
delete_files_test.cc
expire_snapshots_test.cc
fast_append_test.cc
manifest_filter_manager_test.cc
merge_append_test.cc
merging_snapshot_update_test.cc
name_mapping_update_test.cc
row_delta_test.cc
snapshot_manager_test.cc
transaction_test.cc
update_location_test.cc
update_partition_spec_test.cc
update_partition_statistics_test.cc
update_properties_test.cc
update_schema_test.cc
update_sort_order_test.cc
update_statistics_test.cc)
add_iceberg_test(data_test
USE_BUNDLE
SOURCES
arrow_c_data_util_test.cc
data_writer_test.cc
delete_filter_test.cc
delete_loader_test.cc
file_scan_task_reader_test.cc)
endif()
if(ICEBERG_BUILD_SQL_CATALOG
AND ICEBERG_SQL_SQLITE
AND ICEBERG_BUILD_BUNDLE)
add_executable(sql_catalog_test)
target_include_directories(sql_catalog_test PRIVATE "${CMAKE_BINARY_DIR}/iceberg/test/")
target_sources(sql_catalog_test PRIVATE sql_catalog_test.cc)
target_link_libraries(sql_catalog_test
PRIVATE iceberg_sql_catalog_static
"$<IF:$<TARGET_EXISTS:iceberg_bundle_static>,iceberg_bundle_static,iceberg_bundle_shared>"
GTest::gmock_main)
if(MSVC_TOOLCHAIN)
target_compile_options(sql_catalog_test PRIVATE /bigobj)
endif()
add_test(NAME sql_catalog_test COMMAND sql_catalog_test)
endif()
if(ICEBERG_BUILD_REST)
function(add_rest_iceberg_test test_name)
set(options USE_BUNDLE)
set(oneValueArgs)
set(multiValueArgs SOURCES)
cmake_parse_arguments(ARG
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN})
add_executable(${test_name})
target_include_directories(${test_name} PRIVATE "${CMAKE_BINARY_DIR}/iceberg/test/")
target_sources(${test_name} PRIVATE ${ARG_SOURCES})
target_link_libraries(${test_name} PRIVATE GTest::gmock_main iceberg_rest_static)
if(MSVC_TOOLCHAIN)
target_compile_options(${test_name} PRIVATE /bigobj)
endif()
add_test(NAME ${test_name} COMMAND ${test_name})
endfunction()
add_rest_iceberg_test(rest_catalog_test
SOURCES
auth_manager_test.cc
error_handlers_test.cc
endpoint_test.cc
rest_file_io_test.cc
rest_json_serde_test.cc
rest_util_test.cc)
if(ICEBERG_SIGV4)
add_rest_iceberg_test(sigv4_auth_test SOURCES sigv4_auth_test.cc)
target_link_libraries(sigv4_auth_test PRIVATE aws-cpp-sdk-core)
endif()
if(ICEBERG_BUILD_REST_INTEGRATION_TESTS)
add_rest_iceberg_test(rest_catalog_integration_test
SOURCES
rest_catalog_integration_test.cc
util/cmd_util.cc
util/docker_compose_util.cc)
endif()
endif()