@@ -28,75 +28,82 @@ set(ICEBERG_TEST_RESOURCES "${CMAKE_SOURCE_DIR}/test/resources")
2828configure_file ("${CMAKE_SOURCE_DIR} /test/test_config.h.in"
2929 "${CMAKE_BINARY_DIR} /iceberg/test/test_config.h" )
3030
31- add_executable (schema_test)
32- target_sources (schema_test
33- PRIVATE name_mapping_test.cc
34- schema_test.cc
35- schema_field_test.cc
36- type_test.cc
37- transform_test.cc
38- partition_field_test.cc
39- partition_spec_test.cc
40- sort_field_test.cc
41- sort_order_test.cc
42- snapshot_test.cc
43- schema_util_test.cc)
44- target_link_libraries (schema_test PRIVATE iceberg_static GTest::gtest_main GTest::gmock)
45- add_test (NAME schema_test COMMAND schema_test)
31+ function (add_iceberg_test test_name)
32+ set (options USE_BUNDLE)
33+ set (oneValueArgs)
34+ set (multiValueArgs SOURCES )
35+ cmake_parse_arguments (ARG
36+ "${options} "
37+ "${oneValueArgs} "
38+ "${multiValueArgs} "
39+ ${ARGN} )
4640
47- add_executable (table_test)
48- target_include_directories (table_test PRIVATE "${CMAKE_BINARY_DIR} " )
49- target_sources (table_test PRIVATE test_common.cc json_internal_test.cc table_test.cc
50- schema_json_test.cc)
51- target_link_libraries (table_test PRIVATE iceberg_static GTest::gtest_main GTest::gmock)
52- add_test (NAME table_test COMMAND table_test)
41+ add_executable (${test_name} )
42+ target_include_directories (${test_name} PRIVATE "${CMAKE_BINARY_DIR} " )
5343
54- add_executable (expression_test)
55- target_sources (expression_test PRIVATE expression_test.cc literal_test.cc)
56- target_link_libraries (expression_test PRIVATE iceberg_static GTest::gtest_main
57- GTest::gmock)
58- add_test (NAME expression_test COMMAND expression_test)
44+ target_sources (${test_name} PRIVATE ${ARG_SOURCES} )
5945
60- add_executable (json_serde_test)
61- target_include_directories (json_serde_test PRIVATE "${CMAKE_BINARY_DIR} " )
62- target_sources (json_serde_test PRIVATE test_common.cc json_internal_test.cc
63- metadata_serde_test.cc schema_json_test.cc)
64- target_link_libraries (json_serde_test PRIVATE iceberg_static GTest::gtest_main
65- GTest::gmock)
66- add_test (NAME json_serde_test COMMAND json_serde_test)
46+ add_test (NAME ${test_name} COMMAND ${test_name} )
47+ endfunction ()
6748
68- add_executable (util_test)
69- target_sources (util_test PRIVATE formatter_test.cc config_test.cc visit_type_test.cc
70- string_utils_test.cc)
71- target_link_libraries (util_test PRIVATE iceberg_static GTest::gtest_main GTest::gmock)
72- add_test (NAME util_test COMMAND util_test)
49+ add_iceberg_test(schema_test
50+ SOURCES
51+ name_mapping_test.cc
52+ schema_test.cc
53+ schema_field_test.cc
54+ type_test.cc
55+ transform_test.cc
56+ partition_field_test.cc
57+ partition_spec_test.cc
58+ sort_field_test.cc
59+ sort_order_test.cc
60+ snapshot_test.cc
61+ schema_util_test.cc)
62+
63+ add_iceberg_test(table_test
64+ SOURCES
65+ test_common.cc
66+ json_internal_test.cc
67+ table_test.cc
68+ schema_json_test.cc)
69+
70+ add_iceberg_test(expression_test SOURCES expression_test.cc literal_test.cc)
71+
72+ add_iceberg_test(json_serde_test
73+ SOURCES
74+ test_common.cc
75+ json_internal_test.cc
76+ metadata_serde_test.cc
77+ schema_json_test.cc)
78+
79+ add_iceberg_test(util_test
80+ SOURCES
81+ formatter_test.cc
82+ config_test.cc
83+ visit_type_test.cc)
7384
7485if (ICEBERG_BUILD_BUNDLE)
75- add_executable (avro_test)
76- target_sources (avro_test
77- PRIVATE avro_data_test.cc
78- avro_test.cc
79- avro_schema_test.cc
80- avro_stream_test.cc
81- manifest_list_reader_test.cc
82- manifest_reader_test.cc
83- test_common.cc)
84- target_link_libraries (avro_test PRIVATE iceberg_bundle_static GTest::gtest_main
85- GTest::gmock)
86- target_include_directories (avro_test PRIVATE "${CMAKE_BINARY_DIR} " )
87- add_test (NAME avro_test COMMAND avro_test)
86+ add_iceberg_test(avro_test
87+ USE_BUNDLE
88+ SOURCES
89+ avro_data_test.cc
90+ avro_test.cc
91+ avro_schema_test.cc
92+ avro_stream_test.cc
93+ manifest_list_reader_test.cc
94+ test_common.cc)
8895
89- add_executable (arrow_test)
90- target_sources (arrow_test PRIVATE arrow_test.cc arrow_fs_file_io_test.cc
91- metadata_io_test.cc gzip_decompress_test.cc)
92- target_link_libraries (arrow_test PRIVATE iceberg_bundle_static GTest::gtest_main
93- GTest::gmock)
94- add_test (NAME arrow_test COMMAND arrow_test)
96+ add_iceberg_test(arrow_test
97+ USE_BUNDLE
98+ SOURCES
99+ arrow_test.cc
100+ arrow_fs_file_io_test.cc
101+ metadata_io_test.cc
102+ gzip_decompress_test.cc)
95103
96- add_executable (catalog_test)
97- target_include_directories (catalog_test PRIVATE "${CMAKE_BINARY_DIR} " )
98- target_sources (catalog_test PRIVATE test_common.cc in_memory_catalog_test.cc)
99- target_link_libraries (catalog_test PRIVATE iceberg_bundle_static GTest::gtest_main
100- GTest::gmock)
101- add_test (NAME catalog_test COMMAND catalog_test)
104+ add_iceberg_test(catalog_test
105+ USE_BUNDLE
106+ SOURCES
107+ test_common.cc
108+ in_memory_catalog_test.cc)
102109endif ()
0 commit comments