diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 0c37bc37705..e81d4eb8984 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -271,7 +271,8 @@ if (ENABLE_TESTS) # attach all dbms gtest sources grep_gtest_sources(${ClickHouse_SOURCE_DIR}/dbms dbms_gtest_sources) add_executable(unit_tests_dbms ${dbms_gtest_sources}) - target_link_libraries(unit_tests_dbms gtest_main dbms clickhouse_functions) + target_link_libraries(unit_tests_dbms EXCLUDE_FROM_ALL gtest_main dbms clickhouse_functions) + target_compile_options(unit_tests_dbms PRIVATE -Wno-unknown-pragmas) add_check(unit_tests_dbms) endif () diff --git a/dbms/src/Analyzers/tests/CMakeLists.txt b/dbms/src/Analyzers/tests/CMakeLists.txt index a4f331dbd3a..548634a98a6 100644 --- a/dbms/src/Analyzers/tests/CMakeLists.txt +++ b/dbms/src/Analyzers/tests/CMakeLists.txt @@ -1,24 +1,24 @@ -add_executable(collect_aliases collect_aliases.cpp) +add_executable(collect_aliases EXCLUDE_FROM_ALL collect_aliases.cpp) target_link_libraries(collect_aliases dbms) -add_executable(collect_tables collect_tables.cpp) +add_executable(collect_tables EXCLUDE_FROM_ALL collect_tables.cpp) target_link_libraries(collect_tables dbms clickhouse_storages_system) -add_executable(analyze_columns analyze_columns.cpp) +add_executable(analyze_columns EXCLUDE_FROM_ALL analyze_columns.cpp) target_link_libraries(analyze_columns dbms clickhouse_storages_system) -add_executable(type_and_constant_inference type_and_constant_inference.cpp) +add_executable(type_and_constant_inference EXCLUDE_FROM_ALL type_and_constant_inference.cpp) target_link_libraries(type_and_constant_inference clickhouse_storages_system clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) -add_executable(analyze_result_of_query analyze_result_of_query.cpp) +add_executable(analyze_result_of_query EXCLUDE_FROM_ALL analyze_result_of_query.cpp) target_link_libraries(analyze_result_of_query dbms clickhouse_storages_system) -add_executable(translate_positional_arguments translate_positional_arguments.cpp) +add_executable(translate_positional_arguments EXCLUDE_FROM_ALL translate_positional_arguments.cpp) target_link_libraries(translate_positional_arguments dbms) -add_executable(optimize_group_order_limit_by optimize_group_order_limit_by.cpp) +add_executable(optimize_group_order_limit_by EXCLUDE_FROM_ALL optimize_group_order_limit_by.cpp) target_link_libraries(optimize_group_order_limit_by dbms clickhouse_storages_system) -add_executable(analyze_lambdas analyze_lambdas.cpp) +add_executable(analyze_lambdas EXCLUDE_FROM_ALL analyze_lambdas.cpp) target_link_libraries(analyze_lambdas dbms) diff --git a/dbms/src/Common/ZooKeeper/tests/CMakeLists.txt b/dbms/src/Common/ZooKeeper/tests/CMakeLists.txt index a24948240f6..7dddec3b3d3 100644 --- a/dbms/src/Common/ZooKeeper/tests/CMakeLists.txt +++ b/dbms/src/Common/ZooKeeper/tests/CMakeLists.txt @@ -1,23 +1,23 @@ -add_executable(zkutil_test_commands zkutil_test_commands.cpp) +add_executable(zkutil_test_commands EXCLUDE_FROM_ALL zkutil_test_commands.cpp) target_link_libraries(zkutil_test_commands clickhouse_common_zookeeper) -add_executable(zkutil_test_commands_new_lib zkutil_test_commands_new_lib.cpp) +add_executable(zkutil_test_commands_new_lib EXCLUDE_FROM_ALL zkutil_test_commands_new_lib.cpp) target_link_libraries(zkutil_test_commands_new_lib clickhouse_common_zookeeper) -add_executable(zkutil_test_lock zkutil_test_lock.cpp) +add_executable(zkutil_test_lock EXCLUDE_FROM_ALL zkutil_test_lock.cpp) target_link_libraries(zkutil_test_lock clickhouse_common_zookeeper) -add_executable(zkutil_expiration_test zkutil_expiration_test.cpp) +add_executable(zkutil_expiration_test EXCLUDE_FROM_ALL zkutil_expiration_test.cpp) target_link_libraries(zkutil_expiration_test clickhouse_common_zookeeper) -add_executable(zkutil_test_async zkutil_test_async.cpp) +add_executable(zkutil_test_async EXCLUDE_FROM_ALL zkutil_test_async.cpp) target_link_libraries(zkutil_test_async clickhouse_common_zookeeper) -add_executable(zkutil_zookeeper_holder zkutil_zookeeper_holder.cpp) +add_executable(zkutil_zookeeper_holder EXCLUDE_FROM_ALL zkutil_zookeeper_holder.cpp) target_link_libraries(zkutil_zookeeper_holder clickhouse_common_zookeeper) -add_executable (zk_many_watches_reconnect zk_many_watches_reconnect.cpp) +add_executable (zk_many_watches_reconnect EXCLUDE_FROM_ALL zk_many_watches_reconnect.cpp) target_link_libraries (zk_many_watches_reconnect clickhouse_common_zookeeper clickhouse_common_config) -add_executable (zookeeper_impl zookeeper_impl.cpp) +add_executable (zookeeper_impl EXCLUDE_FROM_ALL zookeeper_impl.cpp) target_link_libraries (zookeeper_impl clickhouse_common_zookeeper) diff --git a/dbms/src/Common/tests/CMakeLists.txt b/dbms/src/Common/tests/CMakeLists.txt index 58674cfd543..bf3d8080d6e 100644 --- a/dbms/src/Common/tests/CMakeLists.txt +++ b/dbms/src/Common/tests/CMakeLists.txt @@ -1,76 +1,76 @@ -add_executable (hashes_test hashes_test.cpp) +add_executable (hashes_test EXCLUDE_FROM_ALL hashes_test.cpp) target_link_libraries (hashes_test dbms) -add_executable (sip_hash sip_hash.cpp) +add_executable (sip_hash EXCLUDE_FROM_ALL sip_hash.cpp) target_link_libraries (sip_hash clickhouse_common_io) -add_executable (sip_hash_perf sip_hash_perf.cpp) +add_executable (sip_hash_perf EXCLUDE_FROM_ALL sip_hash_perf.cpp) target_link_libraries (sip_hash_perf clickhouse_common_io) -add_executable (auto_array auto_array.cpp) +add_executable (auto_array EXCLUDE_FROM_ALL auto_array.cpp) target_link_libraries (auto_array clickhouse_common_io) -add_executable (lru_cache lru_cache.cpp) +add_executable (lru_cache EXCLUDE_FROM_ALL lru_cache.cpp) target_link_libraries (lru_cache clickhouse_common_io) -add_executable (hash_table hash_table.cpp) +add_executable (hash_table EXCLUDE_FROM_ALL hash_table.cpp) target_link_libraries (hash_table clickhouse_common_io) -add_executable (small_table small_table.cpp) +add_executable (small_table EXCLUDE_FROM_ALL small_table.cpp) target_link_libraries (small_table clickhouse_common_io) -add_executable (parallel_aggregation parallel_aggregation.cpp) +add_executable (parallel_aggregation EXCLUDE_FROM_ALL parallel_aggregation.cpp) target_link_libraries (parallel_aggregation clickhouse_common_io) -add_executable (parallel_aggregation2 parallel_aggregation2.cpp) +add_executable (parallel_aggregation2 EXCLUDE_FROM_ALL parallel_aggregation2.cpp) target_link_libraries (parallel_aggregation2 clickhouse_common_io) -add_executable (int_hashes_perf int_hashes_perf.cpp AvalancheTest.cpp Random.cpp) +add_executable (int_hashes_perf EXCLUDE_FROM_ALL int_hashes_perf.cpp AvalancheTest.cpp Random.cpp) target_link_libraries (int_hashes_perf clickhouse_common_io) -add_executable (simple_cache simple_cache.cpp) +add_executable (simple_cache EXCLUDE_FROM_ALL simple_cache.cpp) target_include_directories (simple_cache PRIVATE ${DBMS_INCLUDE_DIR}) target_link_libraries (simple_cache common) -add_executable (compact_array compact_array.cpp) +add_executable (compact_array EXCLUDE_FROM_ALL compact_array.cpp) target_link_libraries (compact_array clickhouse_common_io ${Boost_FILESYSTEM_LIBRARY}) -add_executable (radix_sort radix_sort.cpp) +add_executable (radix_sort EXCLUDE_FROM_ALL radix_sort.cpp) target_link_libraries (radix_sort clickhouse_common_io) -add_executable (shell_command_test shell_command_test.cpp) +add_executable (shell_command_test EXCLUDE_FROM_ALL shell_command_test.cpp) target_link_libraries (shell_command_test clickhouse_common_io) -add_executable (arena_with_free_lists arena_with_free_lists.cpp) +add_executable (arena_with_free_lists EXCLUDE_FROM_ALL arena_with_free_lists.cpp) target_link_libraries (arena_with_free_lists clickhouse_common_io) -add_executable (pod_array pod_array.cpp) +add_executable (pod_array EXCLUDE_FROM_ALL pod_array.cpp) target_link_libraries (pod_array clickhouse_common_io) -add_executable (thread_creation_latency thread_creation_latency.cpp) +add_executable (thread_creation_latency EXCLUDE_FROM_ALL thread_creation_latency.cpp) target_link_libraries (thread_creation_latency clickhouse_common_io) -add_executable (thread_pool thread_pool.cpp) +add_executable (thread_pool EXCLUDE_FROM_ALL thread_pool.cpp) target_link_libraries (thread_pool clickhouse_common_io) -add_executable (array_cache array_cache.cpp) +add_executable (array_cache EXCLUDE_FROM_ALL array_cache.cpp) target_link_libraries (array_cache clickhouse_common_io) -add_executable (space_saving space_saving.cpp) +add_executable (space_saving EXCLUDE_FROM_ALL space_saving.cpp) target_link_libraries (space_saving clickhouse_common_io) -add_executable (integer_hash_tables_and_hashes integer_hash_tables_and_hashes.cpp) +add_executable (integer_hash_tables_and_hashes EXCLUDE_FROM_ALL integer_hash_tables_and_hashes.cpp) target_include_directories (integer_hash_tables_and_hashes BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_link_libraries (integer_hash_tables_and_hashes clickhouse_common_io) -add_executable (allocator allocator.cpp) +add_executable (allocator EXCLUDE_FROM_ALL allocator.cpp) target_link_libraries (allocator clickhouse_common_io) -add_executable (cow_columns cow_columns.cpp) +add_executable (cow_columns EXCLUDE_FROM_ALL cow_columns.cpp) target_link_libraries (cow_columns clickhouse_common_io) -add_executable (stopwatch stopwatch.cpp) +add_executable (stopwatch EXCLUDE_FROM_ALL stopwatch.cpp) target_link_libraries (stopwatch clickhouse_common_io) -add_executable (persisted_container persisted_container.cpp) +add_executable (persisted_container EXCLUDE_FROM_ALL persisted_container.cpp) target_link_libraries (persisted_container clickhouse_common_io) \ No newline at end of file diff --git a/dbms/src/Core/tests/CMakeLists.txt b/dbms/src/Core/tests/CMakeLists.txt index f8cfe2eee2c..44c618049e4 100644 --- a/dbms/src/Core/tests/CMakeLists.txt +++ b/dbms/src/Core/tests/CMakeLists.txt @@ -1,18 +1,18 @@ -add_executable (exception exception.cpp) +add_executable (exception EXCLUDE_FROM_ALL exception.cpp) target_link_libraries (exception clickhouse_common_io) -add_executable (string_pool string_pool.cpp) +add_executable (string_pool EXCLUDE_FROM_ALL string_pool.cpp) target_link_libraries (string_pool clickhouse_common_io) target_include_directories (string_pool BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) -add_executable (field field.cpp) +add_executable (field EXCLUDE_FROM_ALL field.cpp) target_link_libraries (field dbms) -add_executable (move_field move_field.cpp) +add_executable (move_field EXCLUDE_FROM_ALL move_field.cpp) target_link_libraries (move_field clickhouse_common_io) -add_executable (rvo_test rvo_test.cpp) +add_executable (rvo_test EXCLUDE_FROM_ALL rvo_test.cpp) target_link_libraries (rvo_test Threads::Threads) -add_executable (string_ref_hash string_ref_hash.cpp) +add_executable (string_ref_hash EXCLUDE_FROM_ALL string_ref_hash.cpp) target_link_libraries (string_ref_hash clickhouse_common_io) diff --git a/dbms/src/DataStreams/tests/CMakeLists.txt b/dbms/src/DataStreams/tests/CMakeLists.txt index 8c3acb1332e..16480553a24 100644 --- a/dbms/src/DataStreams/tests/CMakeLists.txt +++ b/dbms/src/DataStreams/tests/CMakeLists.txt @@ -2,29 +2,29 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) set(SRCS ) -add_executable (tab_separated_streams tab_separated_streams.cpp ${SRCS}) -target_link_libraries (tab_separated_streams dbms) +add_executable (tab_separated_streams EXCLUDE_FROM_ALL tab_separated_streams.cpp ${SRCS}) +target_link_libraries (tab_separated_streams dbms clickhouse_functions) -add_executable (block_row_transforms block_row_transforms.cpp ${SRCS}) -target_link_libraries (block_row_transforms dbms) +add_executable (block_row_transforms EXCLUDE_FROM_ALL block_row_transforms.cpp ${SRCS}) +target_link_libraries (block_row_transforms dbms clickhouse_functions) -add_executable (expression_stream expression_stream.cpp ${SRCS}) -target_link_libraries (expression_stream dbms clickhouse_storages_system) +add_executable (expression_stream EXCLUDE_FROM_ALL expression_stream.cpp ${SRCS}) +target_link_libraries (expression_stream dbms clickhouse_storages_system clickhouse_functions) -add_executable (native_streams native_streams.cpp ${SRCS}) -target_link_libraries (native_streams dbms) +add_executable (native_streams EXCLUDE_FROM_ALL native_streams.cpp ${SRCS}) +target_link_libraries (native_streams dbms clickhouse_functions) -add_executable (filter_stream filter_stream.cpp ${SRCS}) -target_link_libraries (filter_stream dbms clickhouse_storages_system) +add_executable (filter_stream EXCLUDE_FROM_ALL filter_stream.cpp ${SRCS}) +target_link_libraries (filter_stream dbms clickhouse_storages_system clickhouse_functions) -add_executable (filter_stream_hitlog filter_stream_hitlog.cpp ${SRCS}) -target_link_libraries (filter_stream_hitlog dbms) +add_executable (filter_stream_hitlog EXCLUDE_FROM_ALL filter_stream_hitlog.cpp ${SRCS}) +target_link_libraries (filter_stream_hitlog dbms clickhouse_functions) -add_executable (sorting_stream sorting_stream.cpp ${SRCS}) -target_link_libraries (sorting_stream dbms) +add_executable (sorting_stream EXCLUDE_FROM_ALL sorting_stream.cpp ${SRCS}) +target_link_libraries (sorting_stream dbms clickhouse_functions) -add_executable (union_stream2 union_stream2.cpp ${SRCS}) -target_link_libraries (union_stream2 dbms) +add_executable (union_stream2 EXCLUDE_FROM_ALL union_stream2.cpp ${SRCS}) +target_link_libraries (union_stream2 dbms clickhouse_functions) -add_executable (collapsing_sorted_stream collapsing_sorted_stream.cpp ${SRCS}) -target_link_libraries (collapsing_sorted_stream dbms) +add_executable (collapsing_sorted_stream EXCLUDE_FROM_ALL collapsing_sorted_stream.cpp ${SRCS}) +target_link_libraries (collapsing_sorted_stream dbms clickhouse_functions) diff --git a/dbms/src/DataTypes/tests/CMakeLists.txt b/dbms/src/DataTypes/tests/CMakeLists.txt index 6a20692bca0..874350cc3d5 100644 --- a/dbms/src/DataTypes/tests/CMakeLists.txt +++ b/dbms/src/DataTypes/tests/CMakeLists.txt @@ -2,11 +2,11 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) set(SRCS ) -add_executable (data_types_number_fixed data_types_number_fixed.cpp ${SRCS}) +add_executable (data_types_number_fixed EXCLUDE_FROM_ALL data_types_number_fixed.cpp ${SRCS}) target_link_libraries (data_types_number_fixed dbms) -add_executable (data_type_string data_type_string.cpp ${SRCS}) +add_executable (data_type_string EXCLUDE_FROM_ALL data_type_string.cpp ${SRCS}) target_link_libraries (data_type_string dbms) -add_executable (data_type_get_common_type data_type_get_common_type.cpp ${SRCS}) +add_executable (data_type_get_common_type EXCLUDE_FROM_ALL data_type_get_common_type.cpp ${SRCS}) target_link_libraries (data_type_get_common_type dbms gtest_main) diff --git a/dbms/src/Functions/tests/CMakeLists.txt b/dbms/src/Functions/tests/CMakeLists.txt index b8ee368bf43..99a4c1074cd 100644 --- a/dbms/src/Functions/tests/CMakeLists.txt +++ b/dbms/src/Functions/tests/CMakeLists.txt @@ -1,10 +1,10 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) -add_executable (number_traits number_traits.cpp) +add_executable (number_traits EXCLUDE_FROM_ALL number_traits.cpp) target_link_libraries (number_traits dbms) -add_executable (strings_trim strings_trim.cpp) +add_executable (strings_trim EXCLUDE_FROM_ALL strings_trim.cpp) target_link_libraries (strings_trim dbms gtest_main clickhouse_functions) -add_executable (strings_pad strings_pad.cpp) +add_executable (strings_pad EXCLUDE_FROM_ALL strings_pad.cpp) target_link_libraries (strings_pad dbms gtest_main clickhouse_functions) \ No newline at end of file diff --git a/dbms/src/IO/tests/CMakeLists.txt b/dbms/src/IO/tests/CMakeLists.txt index fcaf88d3d64..bf10bf21f12 100644 --- a/dbms/src/IO/tests/CMakeLists.txt +++ b/dbms/src/IO/tests/CMakeLists.txt @@ -1,66 +1,66 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) set(SRCS ) -add_executable (read_buffer read_buffer.cpp ${SRCS}) +add_executable (read_buffer EXCLUDE_FROM_ALL read_buffer.cpp ${SRCS}) target_link_libraries (read_buffer clickhouse_common_io) -add_executable (read_buffer_perf read_buffer_perf.cpp ${SRCS}) +add_executable (read_buffer_perf EXCLUDE_FROM_ALL read_buffer_perf.cpp ${SRCS}) target_link_libraries (read_buffer_perf clickhouse_common_io) -add_executable (read_float_perf read_float_perf.cpp ${SRCS}) +add_executable (read_float_perf EXCLUDE_FROM_ALL read_float_perf.cpp ${SRCS}) target_link_libraries (read_float_perf clickhouse_common_io) -add_executable (write_buffer write_buffer.cpp ${SRCS}) +add_executable (write_buffer EXCLUDE_FROM_ALL write_buffer.cpp ${SRCS}) target_link_libraries (write_buffer clickhouse_common_io) -add_executable (write_buffer_perf write_buffer_perf.cpp ${SRCS}) +add_executable (write_buffer_perf EXCLUDE_FROM_ALL write_buffer_perf.cpp ${SRCS}) target_link_libraries (write_buffer_perf clickhouse_common_io) -add_executable (valid_utf8_perf valid_utf8_perf.cpp ${SRCS}) +add_executable (valid_utf8_perf EXCLUDE_FROM_ALL valid_utf8_perf.cpp ${SRCS}) target_link_libraries (valid_utf8_perf clickhouse_common_io) -add_executable (valid_utf8 valid_utf8.cpp ${SRCS}) +add_executable (valid_utf8 EXCLUDE_FROM_ALL valid_utf8.cpp ${SRCS}) target_link_libraries (valid_utf8 clickhouse_common_io) -add_executable (compressed_buffer compressed_buffer.cpp ${SRCS}) +add_executable (compressed_buffer EXCLUDE_FROM_ALL compressed_buffer.cpp ${SRCS}) target_link_libraries (compressed_buffer clickhouse_common_io) -add_executable (var_uint var_uint.cpp ${SRCS}) +add_executable (var_uint EXCLUDE_FROM_ALL var_uint.cpp ${SRCS}) target_link_libraries (var_uint clickhouse_common_io) -add_executable (read_escaped_string read_escaped_string.cpp ${SRCS}) +add_executable (read_escaped_string EXCLUDE_FROM_ALL read_escaped_string.cpp ${SRCS}) target_link_libraries (read_escaped_string clickhouse_common_io) -add_executable (async_write async_write.cpp ${SRCS}) +add_executable (async_write EXCLUDE_FROM_ALL async_write.cpp ${SRCS}) target_link_libraries (async_write clickhouse_common_io) -add_executable (parse_int_perf parse_int_perf.cpp ${SRCS}) +add_executable (parse_int_perf EXCLUDE_FROM_ALL parse_int_perf.cpp ${SRCS}) target_link_libraries (parse_int_perf clickhouse_common_io) -add_executable (parse_int_perf2 parse_int_perf2.cpp ${SRCS}) +add_executable (parse_int_perf2 EXCLUDE_FROM_ALL parse_int_perf2.cpp ${SRCS}) target_link_libraries (parse_int_perf2 clickhouse_common_io) -add_executable (read_write_int read_write_int.cpp ${SRCS}) +add_executable (read_write_int EXCLUDE_FROM_ALL read_write_int.cpp ${SRCS}) target_link_libraries (read_write_int clickhouse_common_io) -add_executable (mempbrk mempbrk.cpp ${SRCS}) +add_executable (mempbrk EXCLUDE_FROM_ALL mempbrk.cpp ${SRCS}) target_link_libraries (mempbrk clickhouse_common_io) -add_executable (cached_compressed_read_buffer cached_compressed_read_buffer.cpp ${SRCS}) +add_executable (cached_compressed_read_buffer EXCLUDE_FROM_ALL cached_compressed_read_buffer.cpp ${SRCS}) target_link_libraries (cached_compressed_read_buffer clickhouse_common_io) -add_executable (o_direct_and_dirty_pages o_direct_and_dirty_pages.cpp ${SRCS}) +add_executable (o_direct_and_dirty_pages EXCLUDE_FROM_ALL o_direct_and_dirty_pages.cpp ${SRCS}) target_link_libraries (o_direct_and_dirty_pages clickhouse_common_io) -add_executable (hashing_write_buffer hashing_write_buffer.cpp ${SRCS}) +add_executable (hashing_write_buffer EXCLUDE_FROM_ALL hashing_write_buffer.cpp ${SRCS}) target_link_libraries (hashing_write_buffer clickhouse_common_io) add_check(hashing_write_buffer) -add_executable (hashing_read_buffer hashing_read_buffer.cpp) +add_executable (hashing_read_buffer EXCLUDE_FROM_ALL hashing_read_buffer.cpp) target_link_libraries (hashing_read_buffer clickhouse_common_io) add_check (hashing_read_buffer) -add_executable (io_operators operators.cpp ${SRCS}) +add_executable (io_operators EXCLUDE_FROM_ALL operators.cpp ${SRCS}) target_link_libraries (io_operators clickhouse_common_io) if (NOT APPLE AND NOT ARCH_FREEBSD) @@ -71,17 +71,17 @@ if (NOT APPLE AND NOT ARCH_FREEBSD) target_link_libraries (read_buffer_aio clickhouse_common_io ${Boost_FILESYSTEM_LIBRARY}) endif () -add_executable (zlib_buffers zlib_buffers.cpp ${SRCS}) +add_executable (zlib_buffers EXCLUDE_FROM_ALL zlib_buffers.cpp ${SRCS}) target_link_libraries (zlib_buffers clickhouse_common_io) -add_executable (remote_read_write_buffer remote_read_write_buffer.cpp ${SRCS}) +add_executable (remote_read_write_buffer EXCLUDE_FROM_ALL remote_read_write_buffer.cpp ${SRCS}) target_link_libraries (remote_read_write_buffer clickhouse_common_io) -add_executable (limit_read_buffer limit_read_buffer.cpp ${SRCS}) +add_executable (limit_read_buffer EXCLUDE_FROM_ALL limit_read_buffer.cpp ${SRCS}) target_link_libraries (limit_read_buffer clickhouse_common_io) -add_executable (limit_read_buffer2 limit_read_buffer2.cpp ${SRCS}) +add_executable (limit_read_buffer2 EXCLUDE_FROM_ALL limit_read_buffer2.cpp ${SRCS}) target_link_libraries (limit_read_buffer2 clickhouse_common_io) -add_executable (parse_date_time_best_effort parse_date_time_best_effort.cpp ${SRCS}) +add_executable (parse_date_time_best_effort EXCLUDE_FROM_ALL parse_date_time_best_effort.cpp ${SRCS}) target_link_libraries (parse_date_time_best_effort clickhouse_common_io) diff --git a/dbms/src/Interpreters/tests/CMakeLists.txt b/dbms/src/Interpreters/tests/CMakeLists.txt index ad3a24d8608..bcf5ad8179a 100644 --- a/dbms/src/Interpreters/tests/CMakeLists.txt +++ b/dbms/src/Interpreters/tests/CMakeLists.txt @@ -1,51 +1,51 @@ -add_executable (expression expression.cpp) +add_executable (expression EXCLUDE_FROM_ALL expression.cpp) target_link_libraries (expression dbms) -add_executable (create_query create_query.cpp) +add_executable (create_query EXCLUDE_FROM_ALL create_query.cpp) target_link_libraries (create_query dbms) -add_executable (select_query select_query.cpp) +add_executable (select_query EXCLUDE_FROM_ALL select_query.cpp) target_link_libraries (select_query clickhouse_storages_system dbms) -add_executable (aggregate aggregate.cpp) +add_executable (aggregate EXCLUDE_FROM_ALL aggregate.cpp) target_link_libraries (aggregate dbms) -add_executable (hash_map hash_map.cpp) +add_executable (hash_map EXCLUDE_FROM_ALL hash_map.cpp) target_include_directories (hash_map BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_link_libraries (hash_map dbms) -add_executable (hash_map3 hash_map3.cpp) +add_executable (hash_map3 EXCLUDE_FROM_ALL hash_map3.cpp) target_link_libraries (hash_map3 dbms ${FARMHASH_LIBRARIES} ${METROHASH_LIBRARIES}) -add_executable (hash_map_string hash_map_string.cpp) +add_executable (hash_map_string EXCLUDE_FROM_ALL hash_map_string.cpp) target_include_directories (hash_map_string BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_link_libraries (hash_map_string dbms) -add_executable (hash_map_string_2 hash_map_string_2.cpp) +add_executable (hash_map_string_2 EXCLUDE_FROM_ALL hash_map_string_2.cpp) target_link_libraries (hash_map_string_2 dbms) -add_executable (hash_map_string_3 hash_map_string_3.cpp) +add_executable (hash_map_string_3 EXCLUDE_FROM_ALL hash_map_string_3.cpp) target_link_libraries (hash_map_string_3 dbms ${FARMHASH_LIBRARIES} ${METROHASH_LIBRARIES}) target_include_directories (hash_map_string_3 BEFORE PRIVATE ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash) target_include_directories (hash_map_string_3 BEFORE PRIVATE ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src) -add_executable (hash_map_string_small hash_map_string_small.cpp) +add_executable (hash_map_string_small EXCLUDE_FROM_ALL hash_map_string_small.cpp) target_include_directories (hash_map_string_small BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_link_libraries (hash_map_string_small dbms) -add_executable (two_level_hash_map two_level_hash_map.cpp) +add_executable (two_level_hash_map EXCLUDE_FROM_ALL two_level_hash_map.cpp) target_include_directories (two_level_hash_map BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_link_libraries (two_level_hash_map dbms) -add_executable (compiler_test compiler_test.cpp) +add_executable (compiler_test EXCLUDE_FROM_ALL compiler_test.cpp) target_link_libraries (compiler_test dbms) -add_executable (logical_expressions_optimizer logical_expressions_optimizer.cpp) +add_executable (logical_expressions_optimizer EXCLUDE_FROM_ALL logical_expressions_optimizer.cpp) target_link_libraries (logical_expressions_optimizer dbms) -add_executable (in_join_subqueries_preprocessor in_join_subqueries_preprocessor.cpp) +add_executable (in_join_subqueries_preprocessor EXCLUDE_FROM_ALL in_join_subqueries_preprocessor.cpp) target_link_libraries (in_join_subqueries_preprocessor dbms) add_check(in_join_subqueries_preprocessor) -add_executable (users users.cpp) +add_executable (users EXCLUDE_FROM_ALL users.cpp) target_link_libraries (users dbms ${Boost_FILESYSTEM_LIBRARY} dbms) diff --git a/dbms/src/Parsers/tests/CMakeLists.txt b/dbms/src/Parsers/tests/CMakeLists.txt index 54a77b0cf7d..316d68dfece 100644 --- a/dbms/src/Parsers/tests/CMakeLists.txt +++ b/dbms/src/Parsers/tests/CMakeLists.txt @@ -2,12 +2,12 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) set(SRCS ) -add_executable (lexer lexer.cpp ${SRCS}) +add_executable (lexer EXCLUDE_FROM_ALL lexer.cpp ${SRCS}) target_link_libraries (lexer clickhouse_parsers) -add_executable (select_parser select_parser.cpp ${SRCS}) +add_executable (select_parser EXCLUDE_FROM_ALL select_parser.cpp ${SRCS}) target_link_libraries (select_parser clickhouse_parsers) -add_executable (create_parser create_parser.cpp ${SRCS}) +add_executable (create_parser EXCLUDE_FROM_ALL create_parser.cpp ${SRCS}) target_link_libraries (create_parser clickhouse_parsers) diff --git a/dbms/src/Storages/DeltaMerge/Chunk.h b/dbms/src/Storages/DeltaMerge/Chunk.h index 68338876f7e..1d1803bf786 100644 --- a/dbms/src/Storages/DeltaMerge/Chunk.h +++ b/dbms/src/Storages/DeltaMerge/Chunk.h @@ -38,7 +38,7 @@ class Chunk using ColumnMetaMap = std::unordered_map; - Chunk() = default; + Chunk() : Chunk(0, 0) {} Chunk(Handle handle_first_, Handle handle_last_) : handle_start(handle_first_), handle_end(handle_last_), is_delete_range(false) {} explicit Chunk(const HandleRange & delete_range) : handle_start(delete_range.start), handle_end(delete_range.end), is_delete_range(true) { @@ -125,4 +125,4 @@ Block readChunk(const Chunk & chunk, const ColumnDefines & read_column_defines, } // namespace DM -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/dbms/src/Storages/DeltaMerge/DeltaMergeDefines.h b/dbms/src/Storages/DeltaMerge/DeltaMergeDefines.h index f3d13a5387b..d3619f73f6b 100644 --- a/dbms/src/Storages/DeltaMerge/DeltaMergeDefines.h +++ b/dbms/src/Storages/DeltaMerge/DeltaMergeDefines.h @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -62,6 +63,8 @@ struct ColumnDefine ColId id; String name; DataTypePtr type; + + explicit ColumnDefine(ColId id_ = 0, String name_ = "", DataTypePtr type_ = nullptr): id(id_), name(std::move(name_)), type(std::move(type_)) {} }; using ColumnDefines = std::vector; using ColumnDefineMap = std::unordered_map; diff --git a/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp b/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp index 42a5fd58870..74af5d234ff 100644 --- a/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp +++ b/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp @@ -351,7 +351,7 @@ bool DeltaMergeStore::afterInsertOrDelete(const Context & db_context, const DB:: SegmentPtr option; SegmentPtr next; - bool is_split; + bool is_split = false; { std::shared_lock lock(mutex); diff --git a/dbms/src/Storages/DeltaMerge/tests/CMakeLists.txt b/dbms/src/Storages/DeltaMerge/tests/CMakeLists.txt index 38ed85c3eda..ed325652e15 100644 --- a/dbms/src/Storages/DeltaMerge/tests/CMakeLists.txt +++ b/dbms/src/Storages/DeltaMerge/tests/CMakeLists.txt @@ -7,12 +7,12 @@ macro(grep_gtest_sources BASE_DIR DST_VAR) endmacro() # attach all dm gtest sources grep_gtest_sources(${ClickHouse_SOURCE_DIR}/dbms/src/Storages/DeltaMerge/tests dm_gtest_sources) -add_executable(unit_tests_dm ${dm_gtest_sources} dm_basic_include.h) +add_executable(unit_tests_dm EXCLUDE_FROM_ALL ${dm_gtest_sources} dm_basic_include.h) target_link_libraries(unit_tests_dm gtest_main dbms clickhouse_functions) add_check(unit_tests_dm) # add unit test by hand -add_executable(dm_test_storage_delta_merge gtest_dm_storage_delta_merge.cpp) +add_executable(dm_test_storage_delta_merge EXCLUDE_FROM_ALL gtest_dm_storage_delta_merge.cpp) target_include_directories(dm_test_storage_delta_merge BEFORE PUBLIC ${Boost_INCLUDE_DIRS}) target_link_libraries(dm_test_storage_delta_merge dbms @@ -25,20 +25,20 @@ target_link_libraries(dm_test_storage_delta_merge clickhouse_functions ) -add_executable(dm_test_delta_merge_store gtest_dm_delta_merge_store.cpp) +add_executable(dm_test_delta_merge_store EXCLUDE_FROM_ALL gtest_dm_delta_merge_store.cpp) target_link_libraries(dm_test_delta_merge_store dbms gtest_main clickhouse_functions) -add_executable(dm_test_segment gtest_dm_segment.cpp) +add_executable(dm_test_segment EXCLUDE_FROM_ALL gtest_dm_segment.cpp) target_link_libraries(dm_test_segment dbms gtest_main clickhouse_functions) -add_executable(dm_test_disk_value_space gtest_dm_disk_value_space.cpp) +add_executable(dm_test_disk_value_space EXCLUDE_FROM_ALL gtest_dm_disk_value_space.cpp) target_link_libraries(dm_test_disk_value_space dbms gtest_main clickhouse_functions) -add_executable(dm_test_merge_block_stream gtest_dm_delta_merge_block_stream.cpp) +add_executable(dm_test_merge_block_stream EXCLUDE_FROM_ALL gtest_dm_delta_merge_block_stream.cpp) target_link_libraries(dm_test_merge_block_stream dbms gtest_main clickhouse_functions) -add_executable(dm_test_delta_tree gtest_dm_delta_tree.cpp) +add_executable(dm_test_delta_tree EXCLUDE_FROM_ALL gtest_dm_delta_tree.cpp) target_link_libraries(dm_test_delta_tree dbms gtest_main) -add_executable(dm_test_chunk gtest_dm_chunk.cpp) +add_executable(dm_test_chunk EXCLUDE_FROM_ALL gtest_dm_chunk.cpp) target_link_libraries(dm_test_chunk dbms gtest_main) diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp index 228bbfe0bbe..f8d9a797feb 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp @@ -1,6 +1,8 @@ #include #include "dm_basic_include.h" +#include + #include namespace DB @@ -35,15 +37,12 @@ TEST_F(DeltaMergeStore_test, Case1) { // create table Context context = DMTestEnv::getContext(); - ColumnDefine handle_column_define{ - .name = "pk", - .type = std::make_shared(), - .id = 1, - }; + ColumnDefine handle_column_define(1, "pk", std::make_shared()); ColumnDefines table_column_defines; { table_column_defines.emplace_back(handle_column_define); - table_column_defines.emplace_back(ColumnDefine{.name = "col2", .type = std::make_shared(), .id = 2}); + ColumnDefine cd(2, "col2", std::make_shared()); + table_column_defines.emplace_back(cd); } DeltaMergeStorePtr store diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_disk_value_space.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_disk_value_space.cpp index bbc0b56440d..ecb5a3c6a90 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_disk_value_space.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_disk_value_space.cpp @@ -1,6 +1,8 @@ #include "dm_basic_include.h" +#include #include + #include #include @@ -31,11 +33,7 @@ class DiskValueSpace_test : public ::testing::Test storage_pool = std::make_unique(path); Context context = DMTestEnv::getContext(); - table_handle_define = ColumnDefine{ - .name = "pk", - .type = std::make_shared(), - .id = 1, - }; + table_handle_define = ColumnDefine(1, "pk", std::make_shared()); table_columns.clear(); table_columns.emplace_back(table_handle_define); table_columns.emplace_back(VERSION_COLUMN_DEFINE); diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp index 513a0351a16..43d7847ea4d 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp @@ -2,6 +2,8 @@ #include "dm_basic_include.h" +#include + #include #include #include @@ -33,11 +35,7 @@ class Segment_test : public ::testing::Test dropDataInDisk(); storage_pool = std::make_unique(path); Context context = DMTestEnv::getContext(); - table_handle_define = ColumnDefine{ - .name = "pk", - .type = std::make_shared(), - .id = 1, - }; + table_handle_define = ColumnDefine(1, "pk", std::make_shared()); table_columns.clear(); table_columns.emplace_back(table_handle_define); table_columns.emplace_back(VERSION_COLUMN_DEFINE); diff --git a/dbms/src/Storages/Page/tests/CMakeLists.txt b/dbms/src/Storages/Page/tests/CMakeLists.txt index ba573ea9041..36f9de7c47a 100644 --- a/dbms/src/Storages/Page/tests/CMakeLists.txt +++ b/dbms/src/Storages/Page/tests/CMakeLists.txt @@ -18,18 +18,17 @@ add_executable(unit_tests_page_storage EXCLUDE_FROM_ALL ${ps_gtest_sources}) target_link_libraries(unit_tests_page_storage gtest_main page_storage) target_compile_options(unit_tests_page_storage PRIVATE -Wno-unknown-pragmas) add_check(unit_tests_page_storage) - # non googletest -add_executable(page_stress_page_storage stress_page_stroage.cpp) +add_executable(page_stress_page_storage EXCLUDE_FROM_ALL stress_page_stroage.cpp) target_link_libraries(page_stress_page_storage page_storage) target_compile_options(page_stress_page_storage PRIVATE -Wno-format) # turn off printf format check -add_executable(page_utils_get_valid_pages utils_get_valid_pages.cpp) +add_executable(page_utils_get_valid_pages EXCLUDE_FROM_ALL utils_get_valid_pages.cpp) target_link_libraries(page_utils_get_valid_pages page_storage) target_compile_options(page_utils_get_valid_pages PRIVATE -Wno-format) -add_executable(test_page_storage_write_disk_full test_page_storage_write_disk_full.cpp) +add_executable(test_page_storage_write_disk_full EXCLUDE_FROM_ALL test_page_storage_write_disk_full.cpp) target_link_libraries(test_page_storage_write_disk_full dbms) target_compile_options(test_page_storage_write_disk_full PRIVATE -Wno-format) -add_executable(mem_usage_test mem_usage_test.cpp) +add_executable(mem_usage_test EXCLUDE_FROM_ALL mem_usage_test.cpp) diff --git a/dbms/src/Storages/Transaction/tests/CMakeLists.txt b/dbms/src/Storages/Transaction/tests/CMakeLists.txt index dfc66003b79..0e12d26eb13 100644 --- a/dbms/src/Storages/Transaction/tests/CMakeLists.txt +++ b/dbms/src/Storages/Transaction/tests/CMakeLists.txt @@ -1,19 +1,19 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) -add_executable (sync_schema sync_schema.cpp) +add_executable (sync_schema EXCLUDE_FROM_ALL sync_schema.cpp) target_link_libraries (sync_schema dbms) -add_executable (tikv_keyvalue tikv_keyvalue.cpp) +add_executable (tikv_keyvalue EXCLUDE_FROM_ALL tikv_keyvalue.cpp) target_link_libraries (tikv_keyvalue dbms) -add_executable (region_persister region_persister.cpp) +add_executable (region_persister EXCLUDE_FROM_ALL region_persister.cpp) target_link_libraries (region_persister dbms) -add_executable (kvstore kvstore.cpp) +add_executable (kvstore EXCLUDE_FROM_ALL kvstore.cpp) target_link_libraries (kvstore dbms) -add_executable (table_info table_info.cpp) +add_executable (table_info EXCLUDE_FROM_ALL table_info.cpp) target_link_libraries (table_info dbms) -add_executable (leveldb_test leveldb_test.cpp) -target_link_libraries (leveldb_test dbms) \ No newline at end of file +add_executable (leveldb_test EXCLUDE_FROM_ALL leveldb_test.cpp) +target_link_libraries (leveldb_test dbms) diff --git a/dbms/src/Storages/tests/CMakeLists.txt b/dbms/src/Storages/tests/CMakeLists.txt index e0e13f0b1fd..446643eb33e 100644 --- a/dbms/src/Storages/tests/CMakeLists.txt +++ b/dbms/src/Storages/tests/CMakeLists.txt @@ -1,28 +1,28 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) -add_executable (system_numbers system_numbers.cpp) +add_executable (system_numbers EXCLUDE_FROM_ALL system_numbers.cpp) target_link_libraries (system_numbers dbms clickhouse_storages_system) -add_executable (storage_log storage_log.cpp) +add_executable (storage_log EXCLUDE_FROM_ALL storage_log.cpp) target_link_libraries (storage_log dbms) -add_executable (hit_log hit_log.cpp) +add_executable (hit_log EXCLUDE_FROM_ALL hit_log.cpp) target_link_libraries (hit_log dbms) -add_executable (seek_speed_test seek_speed_test.cpp) +add_executable (seek_speed_test EXCLUDE_FROM_ALL seek_speed_test.cpp) target_link_libraries (seek_speed_test dbms) -add_executable (part_checker part_checker.cpp) +add_executable (part_checker EXCLUDE_FROM_ALL part_checker.cpp) target_link_libraries (part_checker dbms) -add_executable (part_name part_name.cpp) +add_executable (part_name EXCLUDE_FROM_ALL part_name.cpp) target_link_libraries (part_name dbms) -add_executable (remove_symlink_directory remove_symlink_directory.cpp) +add_executable (remove_symlink_directory EXCLUDE_FROM_ALL remove_symlink_directory.cpp) target_link_libraries (remove_symlink_directory dbms) -add_executable (merge_selector merge_selector.cpp) +add_executable (merge_selector EXCLUDE_FROM_ALL merge_selector.cpp) target_link_libraries (merge_selector dbms) -add_executable (merge_selector2 merge_selector2.cpp) +add_executable (merge_selector2 EXCLUDE_FROM_ALL merge_selector2.cpp) target_link_libraries (merge_selector2 dbms) diff --git a/docker/builder/build.sh b/docker/builder/build.sh index 8db723b63ba..6e75713e0a5 100755 --- a/docker/builder/build.sh +++ b/docker/builder/build.sh @@ -4,10 +4,14 @@ SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" SRCPATH=${1:-$(cd $SCRIPTPATH/../..; pwd -P)} NPROC=${NPROC:-$(nproc || grep -c ^processor /proc/cpuinfo)} -ENABLE_TEST=${ENABLE_TEST:-0} -ENABLE_EMBEDDED_COMPILER=${DENABLE_EMBEDDED_COMPILER:-1} +ENABLE_TEST=${ENABLE_TEST:-1} +ENABLE_EMBEDDED_COMPILER=${ENABLE_EMBEDDED_COMPILER:-1} CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} +if [[ "${CMAKE_BUILD_TYPE}" != "Debug" ]]; then + ENABLE_TEST=0 +fi + set -xe if [ -d "$SRCPATH/contrib/kvproto" ]; then @@ -19,9 +23,11 @@ fi build_dir="$SRCPATH/build_docker" mkdir -p $build_dir && cd $build_dir -cmake "$SRCPATH" -DENABLE_EMBEDDED_COMPILER=$ENABLE_EMBEDDED_COMPILER -DENABLE_TESTS=$ENABLE_TEST -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE +cmake "$SRCPATH" \ + -DENABLE_EMBEDDED_COMPILER=$ENABLE_EMBEDDED_COMPILER \ + -DENABLE_TESTS=$ENABLE_TEST \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE make -j $NPROC -#ctest -V -j $(nproc || grep -c ^processor /proc/cpuinfo) install_dir="$SRCPATH/docker/builder/tics" if [ -d "$install_dir" ]; then rm -rf "$install_dir"/*; else mkdir -p "$install_dir"; fi @@ -31,3 +37,11 @@ ldd "$build_dir/dbms/src/Server/theflash" | grep '/' | grep '=>' | \ awk -F '=>' '{print $2}' | awk '{print $1}' | while read lib; do cp -f "$lib" "$install_dir" done + +# copy gtest binary under Debug mode +if [[ "${CMAKE_BUILD_TYPE}" = "Debug" && ${ENABLE_TEST} -ne 0 ]]; then + #ctest -V -j $(nproc || grep -c ^processor /proc/cpuinfo) + make -j ${NPROC} unit_tests_dbms unit_tests_libcommon + cp -f "$build_dir/dbms/unit_tests_dbms" "$install_dir/" + cp -f "$build_dir/libs/libcommon/src/tests/unit_tests_libcommon" "$install_dir/" +fi diff --git a/tests/docker/run.sh b/tests/docker/run.sh index 1fa3c5c8e93..f22317497ec 100755 --- a/tests/docker/run.sh +++ b/tests/docker/run.sh @@ -8,6 +8,6 @@ rm -rf ./data ./log docker-compose up -d -docker-compose exec -T tics0 bash -c 'cd /tests ; ./run-test.sh mutable-test' +docker-compose exec -T tics0 bash -c 'cd /tests ; ./run-test.sh mutable-test && ./run-gtest.sh ' docker-compose down diff --git a/tests/run-gtest.sh b/tests/run-gtest.sh new file mode 100755 index 00000000000..88756ea8781 --- /dev/null +++ b/tests/run-gtest.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +/tics/unit_tests_dbms && \ +/tics/unit_tests_libcommon