From e4f06d5a712dbe0e8dce62d63a2ebb2365c3ccb5 Mon Sep 17 00:00:00 2001 From: Pavel Tsayukov Date: Wed, 21 Aug 2024 19:51:55 +0300 Subject: [PATCH] Library unit tests (#291) * Add tests for library/cpp/getopts into listfile (#183) * Add tests for library/cpp/http/fetch into listfile (#184) * Add tests for library/cpp/http/io into listfile (#185) * Add tests for library/cpp/http/misc into listfile (#186) * Add tests for library/cpp/lcs into listfile (#191) * Add tests for library/cpp/streams/brotli into listfile (#198) * Add tests for library/cpp/streams/bzip2 into listfile (#199) * Add tests for library/cpp/streams/zstd into listfile (#201) * Add tests for library/cpp/string_utils into listfile (#202) * Add tests for library/cpp/threading/chunk_queue into listfile (#203) * Add tests for library/cpp/threading/light_rw_lock into listfile (#206) * Add tests for library/cpp/threading/unicode/normalization into listfile (#208) --- library/cpp/getopt/CMakeLists.txt | 4 ++ library/cpp/getopt/ut/CMakeLists.txt | 69 +++++++++++++++++++ library/cpp/http/fetch/CMakeLists.txt | 22 ++++++ library/cpp/http/io/CMakeLists.txt | 54 +++++++++++++++ library/cpp/http/misc/CMakeLists.txt | 32 +++++++++ library/cpp/lcs/CMakeLists.txt | 12 ++++ library/cpp/streams/brotli/CMakeLists.txt | 12 ++++ library/cpp/streams/bzip2/CMakeLists.txt | 12 ++++ library/cpp/streams/zstd/CMakeLists.txt | 12 ++++ library/cpp/string_utils/quote/CMakeLists.txt | 14 +++- .../relaxed_escaper/CMakeLists.txt | 12 ++++ library/cpp/string_utils/url/CMakeLists.txt | 12 ++++ .../cpp/threading/chunk_queue/CMakeLists.txt | 12 ++++ .../threading/light_rw_lock/CMakeLists.txt | 4 ++ .../threading/light_rw_lock/ut/CMakeLists.txt | 9 +++ .../cpp/unicode/normalization/CMakeLists.txt | 4 ++ .../unicode/normalization/ut/CMakeLists.txt | 9 +++ 17 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 library/cpp/getopt/ut/CMakeLists.txt create mode 100644 library/cpp/threading/light_rw_lock/ut/CMakeLists.txt create mode 100644 library/cpp/unicode/normalization/ut/CMakeLists.txt diff --git a/library/cpp/getopt/CMakeLists.txt b/library/cpp/getopt/CMakeLists.txt index ca6a1ad61ff..f64ff40d5cf 100644 --- a/library/cpp/getopt/CMakeLists.txt +++ b/library/cpp/getopt/CMakeLists.txt @@ -1,3 +1,7 @@ +if (YDB_SDK_TESTS) + add_subdirectory(ut) +endif() + _ydb_sdk_add_library(getopt-small) target_link_libraries(getopt-small PUBLIC diff --git a/library/cpp/getopt/ut/CMakeLists.txt b/library/cpp/getopt/ut/CMakeLists.txt new file mode 100644 index 00000000000..ee1a898a7ca --- /dev/null +++ b/library/cpp/getopt/ut/CMakeLists.txt @@ -0,0 +1,69 @@ +add_ydb_test(NAME getopt-last_getopt_ut + SOURCES + last_getopt_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-modchooser_ut + SOURCES + modchooser_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-opt2_ut + SOURCES + opt2_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-opt_ut + SOURCES + opt_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-posix_getopt_ut + SOURCES + posix_getopt_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-wrap_ut + SOURCES + wrap.cpp + LINK_LIBRARIES + getopt-small + cpp-testing-unittest_main + LABELS + unit +) + +add_ydb_test(NAME getopt-ygetopt_ut + SOURCES + ygetopt_ut.cpp + LINK_LIBRARIES + getopt + cpp-testing-unittest_main + LABELS + unit +) diff --git a/library/cpp/http/fetch/CMakeLists.txt b/library/cpp/http/fetch/CMakeLists.txt index 12fe4e060f6..821b12ed803 100644 --- a/library/cpp/http/fetch/CMakeLists.txt +++ b/library/cpp/http/fetch/CMakeLists.txt @@ -1,3 +1,25 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME http-fetch-httpfsm_ut + SOURCES + httpfsm_ut.cpp + LINK_LIBRARIES + http-fetch + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-fetch-httpparser_ut + SOURCES + httpparser_ut.cpp + LINK_LIBRARIES + http-fetch + cpp-testing-unittest_main + LABELS + unit + ) +endif(YDB_SDK_TESTS) + _ydb_sdk_add_library(http-fetch) target_link_libraries(http-fetch diff --git a/library/cpp/http/io/CMakeLists.txt b/library/cpp/http/io/CMakeLists.txt index 65fb7215ef6..f3f3f5afb51 100644 --- a/library/cpp/http/io/CMakeLists.txt +++ b/library/cpp/http/io/CMakeLists.txt @@ -1,3 +1,57 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME http-io-chunk_ut + SOURCES + chunk_ut.cpp + LINK_LIBRARIES + http-io + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-io-compression_ut + SOURCES + compression_ut.cpp + LINK_LIBRARIES + http-io + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-io-headers_ut + SOURCES + headers_ut.cpp + LINK_LIBRARIES + http-io + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-io-stream_ut + SOURCES + stream_ut.cpp + LINK_LIBRARIES + yutil + http-io + http-server + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-io-stream_ut_medium + SOURCES + stream_ut_medium.cpp + LINK_LIBRARIES + http-io + cpp-testing-unittest_main + LABELS + unit + ) +endif(YDB_SDK_TESTS) + _ydb_sdk_add_library(http-io) target_link_libraries(http-io diff --git a/library/cpp/http/misc/CMakeLists.txt b/library/cpp/http/misc/CMakeLists.txt index 24f85a90fe2..768628b3e9b 100644 --- a/library/cpp/http/misc/CMakeLists.txt +++ b/library/cpp/http/misc/CMakeLists.txt @@ -1,3 +1,35 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME http-misc-httpdate_ut + SOURCES + httpdate_ut.cpp + LINK_LIBRARIES + http-misc + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-misc-httpreqdata_ut + SOURCES + httpreqdata_ut.cpp + LINK_LIBRARIES + http-misc + cpp-testing-unittest_main + LABELS + unit + ) + + add_ydb_test(NAME http-misc-parsed_request_ut + SOURCES + parsed_request_ut.cpp + LINK_LIBRARIES + http-misc + cpp-testing-unittest_main + LABELS + unit + ) +endif(YDB_SDK_TESTS) + _ydb_sdk_add_library(http-misc) target_link_libraries(http-misc diff --git a/library/cpp/lcs/CMakeLists.txt b/library/cpp/lcs/CMakeLists.txt index aae1e3664a1..e48e848ebbd 100644 --- a/library/cpp/lcs/CMakeLists.txt +++ b/library/cpp/lcs/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME lcs-lcs_via_lis_ut + SOURCES + lcs_via_lis_ut.cpp + LINK_LIBRARIES + lcs + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(lcs) target_link_libraries(lcs diff --git a/library/cpp/streams/brotli/CMakeLists.txt b/library/cpp/streams/brotli/CMakeLists.txt index 84bd7bfa1bf..e6dd2a84eac 100644 --- a/library/cpp/streams/brotli/CMakeLists.txt +++ b/library/cpp/streams/brotli/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME streams-brotli-ut + SOURCES + brotli_ut.cpp + LINK_LIBRARIES + streams-brotli + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(streams-brotli) target_link_libraries(streams-brotli diff --git a/library/cpp/streams/bzip2/CMakeLists.txt b/library/cpp/streams/bzip2/CMakeLists.txt index f90adbcf427..8f2ef9e46a5 100644 --- a/library/cpp/streams/bzip2/CMakeLists.txt +++ b/library/cpp/streams/bzip2/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME streams-bzip2-ut + SOURCES + bzip2_ut.cpp + LINK_LIBRARIES + streams-bzip2 + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(streams-bzip2) target_link_libraries(streams-bzip2 diff --git a/library/cpp/streams/zstd/CMakeLists.txt b/library/cpp/streams/zstd/CMakeLists.txt index f12e3a31f8d..b18333e3385 100644 --- a/library/cpp/streams/zstd/CMakeLists.txt +++ b/library/cpp/streams/zstd/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME streams-zstd-ut + SOURCES + zstd_ut.cpp + LINK_LIBRARIES + streams-zstd + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(streams-zstd) target_link_libraries(streams-zstd PUBLIC diff --git a/library/cpp/string_utils/quote/CMakeLists.txt b/library/cpp/string_utils/quote/CMakeLists.txt index 4e761636244..79aafb2e319 100644 --- a/library/cpp/string_utils/quote/CMakeLists.txt +++ b/library/cpp/string_utils/quote/CMakeLists.txt @@ -1,6 +1,18 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME string_utils-quote-ut + SOURCES + quote_ut.cpp + LINK_LIBRARIES + string_utils-quote + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(string_utils-quote) -target_link_libraries(string_utils-quote +target_link_libraries(string_utils-quote PUBLIC yutil ) diff --git a/library/cpp/string_utils/relaxed_escaper/CMakeLists.txt b/library/cpp/string_utils/relaxed_escaper/CMakeLists.txt index 060f387e3fc..fea2d62aabe 100644 --- a/library/cpp/string_utils/relaxed_escaper/CMakeLists.txt +++ b/library/cpp/string_utils/relaxed_escaper/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME string_utils-relaxed_escaper-ut + SOURCES + relaxed_escaper_ut.cpp + LINK_LIBRARIES + string_utils-relaxed_escaper + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(string_utils-relaxed_escaper) target_link_libraries(string_utils-relaxed_escaper diff --git a/library/cpp/string_utils/url/CMakeLists.txt b/library/cpp/string_utils/url/CMakeLists.txt index 3e88d6846cc..ab20705d364 100644 --- a/library/cpp/string_utils/url/CMakeLists.txt +++ b/library/cpp/string_utils/url/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME string_utils-url-ut + SOURCES + url_ut.cpp + LINK_LIBRARIES + string_utils-url + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(string_utils-url) target_link_libraries(string_utils-url diff --git a/library/cpp/threading/chunk_queue/CMakeLists.txt b/library/cpp/threading/chunk_queue/CMakeLists.txt index 8dfb90e9f34..f3a5bb4307a 100644 --- a/library/cpp/threading/chunk_queue/CMakeLists.txt +++ b/library/cpp/threading/chunk_queue/CMakeLists.txt @@ -1,3 +1,15 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME threading-chunk_queue-ut + SOURCES + queue_ut.cpp + LINK_LIBRARIES + threading-chunk_queue + cpp-testing-unittest_main + LABELS + unit + ) +endif() + _ydb_sdk_add_library(threading-chunk_queue) target_link_libraries(threading-chunk_queue PUBLIC diff --git a/library/cpp/threading/light_rw_lock/CMakeLists.txt b/library/cpp/threading/light_rw_lock/CMakeLists.txt index c60a8c0195e..3735a286ad0 100644 --- a/library/cpp/threading/light_rw_lock/CMakeLists.txt +++ b/library/cpp/threading/light_rw_lock/CMakeLists.txt @@ -1,3 +1,7 @@ +if (YDB_SDK_TESTS) + add_subdirectory(ut) +endif() + _ydb_sdk_add_library(threading-light_rw_lock) target_link_libraries(threading-light_rw_lock PUBLIC diff --git a/library/cpp/threading/light_rw_lock/ut/CMakeLists.txt b/library/cpp/threading/light_rw_lock/ut/CMakeLists.txt new file mode 100644 index 00000000000..8545c251d93 --- /dev/null +++ b/library/cpp/threading/light_rw_lock/ut/CMakeLists.txt @@ -0,0 +1,9 @@ +add_ydb_test(NAME threading-light_rw_lock-ut + SOURCES + rwlock_ut.cpp + LINK_LIBRARIES + threading-light_rw_lock + cpp-testing-unittest_main + LABELS + unit +) diff --git a/library/cpp/unicode/normalization/CMakeLists.txt b/library/cpp/unicode/normalization/CMakeLists.txt index 8ffe5caef08..c3a653e2ddb 100644 --- a/library/cpp/unicode/normalization/CMakeLists.txt +++ b/library/cpp/unicode/normalization/CMakeLists.txt @@ -1,3 +1,7 @@ +if (YDB_SDK_TESTS) + add_subdirectory(ut) +endif() + _ydb_sdk_add_library(unicode-normalization) target_link_libraries(unicode-normalization PUBLIC diff --git a/library/cpp/unicode/normalization/ut/CMakeLists.txt b/library/cpp/unicode/normalization/ut/CMakeLists.txt new file mode 100644 index 00000000000..69d818af14b --- /dev/null +++ b/library/cpp/unicode/normalization/ut/CMakeLists.txt @@ -0,0 +1,9 @@ +add_ydb_test(NAME unicode-normalization-ut + SOURCES + normalization_ut.cpp + LINK_LIBRARIES + unicode-normalization + cpp-testing-unittest_main + LABELS + unit +)