From e54b23eb1c22bddb8aecf90ded5fcb0d128c60b3 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Tue, 6 Aug 2024 19:51:16 +0300
Subject: [PATCH 1/9] Add tests for util/datetime into listfile (#155)
---
util/CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 7fa756c4fa..c064dad7a9 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -1,7 +1,43 @@
add_subdirectory(charset)
add_subdirectory(draft)
+function(add_ydb_util_tests)
+ set(opts "")
+ set(oneval_args FOLDER)
+ set(multival_args TESTS LINK_LIBRARIES)
+ cmake_parse_arguments(ARGS
+ "${opts}"
+ "${oneval_args}"
+ "${multival_args}"
+ ${ARGN}
+ )
+ list(PREPEND ARGS_LINK_LIBRARIES
+ yutil
+ cpp-testing-unittest_main
+ )
+ foreach (__test_name_suffix IN LISTS ARGS_TESTS)
+ add_ydb_test(NAME "util-${ARGS_FOLDER}-${__test_name_suffix}"
+ SOURCES
+ "${ARGS_FOLDER}/${__test_name_suffix}.cpp"
+ LINK_LIBRARIES
+ ${ARGS_LINK_LIBRARIES}
+ LABELS
+ unit
+ )
+ endforeach()
+endfunction()
+
if (YDB_SDK_TESTS)
+ add_ydb_util_tests(FOLDER datetime
+ TESTS
+ base_ut
+ cputimer_ut
+ parser_deprecated_ut
+ parser_ut
+ process_uptime_ut
+ uptime_ut
+ )
+
add_ydb_test(NAME util-digest-ut
SOURCES
digest/city_ut.cpp
@@ -70,6 +106,7 @@ target_joined_source(yutil
${YDB_SDK_SOURCE_DIR}/util/datetime/base.cpp
${YDB_SDK_SOURCE_DIR}/util/datetime/constants.cpp
${YDB_SDK_SOURCE_DIR}/util/datetime/cputimer.cpp
+ ${YDB_SDK_SOURCE_DIR}/util/datetime/process_uptime.cpp
${YDB_SDK_SOURCE_DIR}/util/datetime/systime.cpp
${YDB_SDK_SOURCE_DIR}/util/datetime/uptime.cpp
)
From d069898365539213519a71b45bdd8b04e2c8add2 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 16:05:58 +0300
Subject: [PATCH 2/9] Wrap other tests with 'add_ydb_util_tests'
---
util/CMakeLists.txt | 61 +++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 36 deletions(-)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index c064dad7a9..4eff1ce50c 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -38,48 +38,37 @@ if (YDB_SDK_TESTS)
uptime_ut
)
- add_ydb_test(NAME util-digest-ut
- SOURCES
- digest/city_ut.cpp
- digest/fnv_ut.cpp
- digest/multi_ut.cpp
- digest/murmur_ut.cpp
- digest/sequence_ut.cpp
- LINK_LIBRARIES
- yutil
- cpp-testing-unittest_main
- LABELS
- unit
+ add_ydb_util_tests(FOLDER digest
+ TESTS
+ city_ut
+ fnv_ut
+ multi_ut
+ murmur_ut
+ sequence_ut
)
- add_ydb_test(NAME util-folder-ut
- SOURCES
- folder/dirut_ut.cpp
- folder/filelist_ut.cpp
- folder/fts_ut.cpp
- folder/iterator_ut.cpp
- folder/path_ut.cpp
- folder/pathsplit_ut.cpp
+
+ add_ydb_util_tests(FOLDER folder
+ TESTS
+ dirut_ut
+ filelist_ut
+ fts_ut
+ iterator_ut
+ path_ut
+ pathsplit_ut
LINK_LIBRARIES
- yutil
- cpp-testing-unittest_main
threading-future
- LABELS
- unit
)
- add_ydb_test(NAME util-network-ut
- SOURCES
- network/address_ut.cpp
- network/endpoint_ut.cpp
- network/ip_ut.cpp
- network/poller_ut.cpp
- network/sock_ut.cpp
- network/socket_ut.cpp
+
+ add_ydb_util_tests(FOLDER network
+ TESTS
+ address_ut
+ endpoint_ut
+ ip_ut
+ poller_ut
+ sock_ut
+ socket_ut
LINK_LIBRARIES
- yutil
- cpp-testing-unittest_main
threading-future
- LABELS
- unit
)
endif()
From 3e9713a2353a865e45765e12743986607aa98c24 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 16:40:16 +0300
Subject: [PATCH 3/9] Add tests for util/generic into listfile (#158)
---
util/CMakeLists.txt | 73 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 4eff1ce50c..f6c27d515c 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -59,6 +59,79 @@ if (YDB_SDK_TESTS)
threading-future
)
+ add_ydb_util_tests(FOLDER generic
+ TESTS
+ adaptor_ut
+ algorithm_ut
+ array_ref_ut
+ array_size_ut
+ bitmap_ut
+ bitops_ut
+ buffer_ut
+ cast_ut
+ deque_ut
+ enum_range_ut
+ explicit_type_ut
+ flags_ut
+ function_ref_ut
+ function_ut
+ guid_ut
+ hash_primes_ut
+ hash_ut
+ intrlist_ut
+ is_in_ut
+ iterator_range_ut
+ iterator_ut
+ lazy_value_ut
+ list_ut
+ mapfindptr_ut
+ map_ut
+ maybe_ut
+ mem_copy_ut
+ objects_counter_ut
+ overloaded_ut
+ ptr_ut
+ queue_ut
+ scope_ut
+ serialized_enum_ut
+ set_ut
+ singleton_ut
+ size_literals_ut
+ stack_ut
+ store_policy_ut
+ strbuf_ut
+ # TODO: either add library/cpp/containers/absl_flat_hash
+ # or use __cplusplus macro to switch to C++20 and use std::unordered_set
+ # string_transparent_hash_ut
+ string_ut
+ typelist_ut
+ typetraits_ut
+ utility_ut
+ va_args_ut
+ vector_ut
+ xrange_ut
+ ylimits_ut
+ ymath_ut
+ )
+
+ add_ydb_test(NAME util-generic-yexception_ut
+ SOURCES
+ generic/yexception_ut.c
+ generic/yexception_ut.cpp
+ LINK_LIBRARIES
+ yutil
+ cpp-testing-unittest_main
+ LABELS
+ unit
+ )
+ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin)$")
+ target_compile_definitions(util-generic-yexception_ut
+ PRIVATE
+ LIBCXX_BUILDING_LIBCXXRT
+ LIBCXX_BUILDING_LIBGCC
+ )
+ endif()
+
add_ydb_util_tests(FOLDER network
TESTS
address_ut
From d7420351ea49ca6378d31d2ba0a717e39d921aad Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 16:43:34 +0300
Subject: [PATCH 4/9] Add tests for util/memory into listfile (#159)
---
util/CMakeLists.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index f6c27d515c..8987807cbe 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -132,6 +132,15 @@ if (YDB_SDK_TESTS)
)
endif()
+ add_ydb_util_tests(FOLDER memory
+ TESTS
+ addstorage_ut
+ blob_ut
+ pool_ut
+ smallobj_ut
+ tempbuf_ut
+ )
+
add_ydb_util_tests(FOLDER network
TESTS
address_ut
From 1137eba8dc14e3235155eb85c0a8ebbbc22a0fe5 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 17:02:24 +0300
Subject: [PATCH 5/9] Add tests for util/random into listfile (#161)
---
util/CMakeLists.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 8987807cbe..f262a86cad 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -141,6 +141,19 @@ if (YDB_SDK_TESTS)
tempbuf_ut
)
+ add_ydb_util_tests(FOLDER random
+ TESTS
+ # TODO: fix common_ops_ut: TestStlCompatibility
+ common_ops_ut
+ easy_ut
+ entropy_ut
+ fast_ut
+ mersenne_ut
+ normal_ut
+ random_ut
+ shuffle_ut
+ )
+
add_ydb_util_tests(FOLDER network
TESTS
address_ut
From 8e32c0f9fe1229bd9d422ea76ae64e535f8ac221 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 17:07:15 +0300
Subject: [PATCH 6/9] Add tests for util/stream into listfile (#162)
---
util/CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++---------
1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index f262a86cad..7c5d908ac9 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -141,6 +141,18 @@ if (YDB_SDK_TESTS)
tempbuf_ut
)
+ add_ydb_util_tests(FOLDER network
+ TESTS
+ address_ut
+ endpoint_ut
+ ip_ut
+ poller_ut
+ sock_ut
+ socket_ut
+ LINK_LIBRARIES
+ threading-future
+ )
+
add_ydb_util_tests(FOLDER random
TESTS
# TODO: fix common_ops_ut: TestStlCompatibility
@@ -154,16 +166,28 @@ if (YDB_SDK_TESTS)
shuffle_ut
)
- add_ydb_util_tests(FOLDER network
+ add_ydb_util_tests(FOLDER stream
TESTS
- address_ut
- endpoint_ut
- ip_ut
- poller_ut
- sock_ut
- socket_ut
- LINK_LIBRARIES
- threading-future
+ aligned_ut
+ buffered_ut
+ buffer_ut
+ direct_io_ut
+ file_ut
+ format_std_ut
+ format_ut
+ hex_ut
+ input_ut
+ ios_ut
+ labeled_ut
+ length_ut
+ mem_ut
+ multi_ut
+ printf_ut
+ str_ut
+ tokenizer_ut
+ walk_ut
+ zerocopy_output_ut
+ zlib_ut
)
endif()
From b910b57cf5fc5588397cdc4e96e3ddc841543fb0 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 17:13:05 +0300
Subject: [PATCH 7/9] Add tests for util/string into listfile (#163)
---
util/CMakeLists.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 7c5d908ac9..91cfd4478f 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -189,6 +189,24 @@ if (YDB_SDK_TESTS)
zerocopy_output_ut
zlib_ut
)
+
+ add_ydb_util_tests(FOLDER string
+ TESTS
+ ascii_ut
+ builder_ut
+ cast_ut
+ escape_ut
+ hex_ut
+ join_ut
+ printf_ut
+ split_ut
+ strip_ut
+ strspn_ut
+ subst_ut
+ type_ut
+ util_ut
+ vector_ut
+ )
endif()
_ydb_sdk_add_library(yutil)
From fcc2203bf2e06465af70d0674e3d464246440586 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 17:17:04 +0300
Subject: [PATCH 8/9] Add tests for util/system into listfile (#164)
---
util/CMakeLists.txt | 87 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 91cfd4478f..04847bb696 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -207,6 +207,93 @@ if (YDB_SDK_TESTS)
util_ut
vector_ut
)
+
+ add_ydb_util_tests(FOLDER system
+ TESTS
+ align_ut
+ atexit_ut
+ backtrace_ut
+ byteorder_ut
+ compat_ut
+ compiler_ut
+ condvar_ut
+ context_ut
+ cpu_id_ut
+ daemon_ut
+ datetime_ut
+ # TODO: direct_io_ut freezes
+ direct_io_ut
+ env_ut
+ error_ut
+ event_ut
+ execpath_ut
+ filemap_ut
+ file_ut
+ flock_ut
+ # TODO: fix fstat_ut
+ # TestFileStat::SymlinkToExistingFileTest
+ # TestFileStat::SymlinkToNonExistingFileTest
+ # TestFileStat::SymlinkToFileThatCantExistTest
+ fstat_ut
+ fs_ut
+ getpid_ut
+ guard_ut
+ hi_lo_ut
+ hostname_ut
+ info_ut
+ interrupt_signals_ut
+ mem_info_ut
+ mincore_ut
+ mktemp_ut
+ mutex_ut
+ nice_ut
+ pipe_ut
+ platform_ut
+ # TODO: fix progname_ut
+ # TProgramNameTest::TestIt
+ progname_ut
+ rusage_ut
+ rwlock_ut
+ sanitizers_ut
+ shellcommand_ut
+ shmat_ut
+ spinlock_ut
+ # TODO: fix src_location_ut
+ # TestLocation::Test1
+ src_location_ut
+ # TODO: fix src_root_ut
+ # TestSourceRoot::TestStrip
+ src_root_ut
+ tempfile_ut
+ # TODO: fix thread_ut
+ # TSysThreadTest::TestSetGetThreadNameInChildThread
+ thread_ut
+ tls_ut
+ # TODO: fix type_name_ut
+ # TypeName::FromWellKnownTypes
+ # TypeName::FromWellKnownValues
+ # TypeName::FromWellKnownValues
+ type_name_ut
+ types_ut
+ # TODO: add library/cpp/testing/benchmark
+ # depends only on NBench::Clobber, that's a memory optimization barrier
+ # unaligned_mem_ut
+ user_ut
+ yassert_ut
+ )
+
+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ add_ydb_test(NAME util-system-fs_win_ut
+ SOURCES
+ system/fs_win_ut.cpp
+ LINK_LIBRARIES
+ yutil
+ cpp-testing-unittest_main
+ LABELS
+ unit
+ )
+ endif()
+
endif()
_ydb_sdk_add_library(yutil)
From 57cfadc3fb45b464f607c151d54643313b3d2e83 Mon Sep 17 00:00:00 2001
From: Pavel Tsayukov
Date: Wed, 7 Aug 2024 18:07:27 +0300
Subject: [PATCH 9/9] Add tests for util/thread into listfile (#165)
---
util/CMakeLists.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 04847bb696..3fe4e1803d 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -294,6 +294,16 @@ if (YDB_SDK_TESTS)
)
endif()
+ add_ydb_util_tests(FOLDER thread
+ TESTS
+ factory_ut
+ lfqueue_ut
+ lfstack_ut
+ pool_ut
+ singleton_ut
+ LINK_LIBRARIES
+ threading-future
+ )
endif()
_ydb_sdk_add_library(yutil)