@@ -28,73 +28,97 @@ 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)
46-
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)
53-
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)
59-
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)
67-
68- add_executable (util_test)
69- target_sources (util_test PRIVATE formatter_test.cc config_test.cc visit_type_test.cc)
70- target_link_libraries (util_test PRIVATE iceberg_static GTest::gtest_main GTest::gmock)
71- add_test (NAME util_test COMMAND util_test)
31+ function (iceberg_add_test test_name)
32+ cmake_parse_arguments (ARG
33+ "USE_BUNDLE"
34+ "INCLUDE_DIR"
35+ "SRCS"
36+ ${ARGN} )
37+
38+ add_executable (${test_name} )
39+ if (ARG_INCLUDE_DIR)
40+ target_include_directories (${test_name} PRIVATE "${ARG_INCLUDE_DIR} " )
41+ endif ()
42+
43+ target_sources (${test_name} PRIVATE ${ARG_SRCS} )
44+
45+ if (ARG_USE_BUNDLE)
46+ target_link_libraries (${test_name} PRIVATE iceberg_bundle_static GTest::gtest_main
47+ GTest::gmock)
48+ else ()
49+ target_link_libraries (${test_name} PRIVATE iceberg_static GTest::gtest_main
50+ GTest::gmock)
51+ endif ()
52+
53+ add_test (NAME ${test_name} COMMAND ${test_name} )
54+ endfunction ()
55+
56+ iceberg_add_test(schema_test
57+ SRCS
58+ name_mapping_test.cc
59+ schema_test.cc
60+ schema_field_test.cc
61+ type_test.cc
62+ transform_test.cc
63+ partition_field_test.cc
64+ partition_spec_test.cc
65+ sort_field_test.cc
66+ sort_order_test.cc
67+ snapshot_test.cc
68+ schema_util_test.cc)
69+
70+ iceberg_add_test(table_test
71+ INCLUDE_DIR
72+ "${CMAKE_BINARY_DIR} "
73+ SRCS
74+ test_common.cc
75+ json_internal_test.cc
76+ table_test.cc
77+ schema_json_test.cc)
78+
79+ iceberg_add_test(expression_test SRCS expression_test.cc literal_test.cc)
80+
81+ iceberg_add_test(json_serde_test
82+ INCLUDE_DIR
83+ "${CMAKE_BINARY_DIR} "
84+ SRCS
85+ test_common.cc
86+ json_internal_test.cc
87+ metadata_serde_test.cc
88+ schema_json_test.cc)
89+
90+ iceberg_add_test(util_test
91+ SRCS
92+ formatter_test.cc
93+ config_test.cc
94+ visit_type_test.cc)
7295
7396if (ICEBERG_BUILD_BUNDLE)
74- add_executable (avro_test)
75- target_sources (avro_test
76- PRIVATE avro_data_test.cc
77- avro_test.cc
78- avro_schema_test.cc
79- avro_stream_test.cc
80- manifest_list_reader_test.cc
81- test_common.cc)
82- target_link_libraries (avro_test PRIVATE iceberg_bundle_static GTest::gtest_main
83- GTest::gmock)
84- target_include_directories (avro_test PRIVATE "${CMAKE_BINARY_DIR} " )
85- add_test (NAME avro_test COMMAND avro_test)
86-
87- add_executable (arrow_test)
88- target_sources (arrow_test PRIVATE arrow_test.cc arrow_fs_file_io_test.cc
89- metadata_io_test.cc gzip_decompress_test.cc)
90- target_link_libraries (arrow_test PRIVATE iceberg_bundle_static GTest::gtest_main
91- GTest::gmock)
92- add_test (NAME arrow_test COMMAND arrow_test)
93-
94- add_executable (catalog_test)
95- target_include_directories (catalog_test PRIVATE "${CMAKE_BINARY_DIR} " )
96- target_sources (catalog_test PRIVATE test_common.cc in_memory_catalog_test.cc)
97- target_link_libraries (catalog_test PRIVATE iceberg_bundle_static GTest::gtest_main
98- GTest::gmock)
99- add_test (NAME catalog_test COMMAND catalog_test)
97+ iceberg_add_test(avro_test
98+ USE_BUNDLE
99+ INCLUDE_DIR
100+ "${CMAKE_BINARY_DIR} "
101+ SRCS
102+ avro_data_test.cc
103+ avro_test.cc
104+ avro_schema_test.cc
105+ avro_stream_test.cc
106+ manifest_list_reader_test.cc
107+ test_common.cc)
108+
109+ iceberg_add_test(arrow_test
110+ USE_BUNDLE
111+ SRCS
112+ arrow_test.cc
113+ arrow_fs_file_io_test.cc
114+ metadata_io_test.cc
115+ gzip_decompress_test.cc)
116+
117+ iceberg_add_test(catalog_test
118+ USE_BUNDLE
119+ INCLUDE_DIR
120+ "${CMAKE_BINARY_DIR} "
121+ SRCS
122+ test_common.cc
123+ in_memory_catalog_test.cc)
100124endif ()
0 commit comments