diff --git a/README.md b/README.md index 9475dcfb66..707102e16e 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,14 @@ cmake --build --preset release ## Test -Specify a level of parallelism by passing the `-j` option into the command below (e.g. `-j$(nproc)`) +Configure and build tests: + +```bash +cmake --preset release-test +cmake --build --preset release +``` + +Specify a level of parallelism by passing the `-j` option into the commands below (e.g. `-j$(nproc)`). Running all tests: @@ -143,9 +150,5 @@ ctest -j$(nproc) --preset release-integration Note that some tests use a legacy test library instead of GoogleTest, see `./ --help` for details. If you need to run only certain test cases, here is an alternative for `--gtest_filter` option: ```bash -cat < --filter-file /dev/fd/0 --ExcludedTestCase -+IncludedTestCase -+IncludedTestCase::TestName -EOF +./ -ExcludedTestSuite +IncludedTestSuite::TestName ``` diff --git a/library/cpp/blockcodecs/CMakeLists.txt b/library/cpp/blockcodecs/CMakeLists.txt index 2982c27142..6b32fa3c0c 100644 --- a/library/cpp/blockcodecs/CMakeLists.txt +++ b/library/cpp/blockcodecs/CMakeLists.txt @@ -1,3 +1,18 @@ +if (YDB_SDK_TESTS) + add_ydb_test(NAME blockcodecs-ut + SOURCES + codecs_ut.cpp + LINK_LIBRARIES + blockcodecs + cpp-testing-unittest_main + LABELS + unit + TEST_ARG + # Exclude this test case, because we don't use zstd06 + -TBlockCodecsTest::TestListAllCodecs + ) +endif(YDB_SDK_TESTS) + _ydb_sdk_add_library(blockcodecs-core) target_link_libraries(blockcodecs-core PUBLIC @@ -29,7 +44,7 @@ _ydb_sdk_install_targets(TARGETS blockcodecs-codecs-brotli) _ydb_sdk_add_library(blockcodecs-codecs-bzip INTERFACE) add_global_library_for(blockcodecs-codecs-bzip.global blockcodecs-codecs-bzip) -target_link_libraries(blockcodecs-codecs-bzip.global +target_link_libraries(blockcodecs-codecs-bzip.global PRIVATE yutil BZip2::BZip2 @@ -144,7 +159,7 @@ _ydb_sdk_install_targets(TARGETS blockcodecs-codecs-zstd) _ydb_sdk_add_library(blockcodecs) -target_link_libraries(blockcodecs +target_link_libraries(blockcodecs PUBLIC yutil blockcodecs-core @@ -157,7 +172,7 @@ target_link_libraries(blockcodecs blockcodecs-codecs-zlib blockcodecs-codecs-zstd ) -target_sources(blockcodecs +target_sources(blockcodecs PRIVATE codecs.cpp stream.cpp diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 9220b75b74..350983faf7 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -185,10 +185,7 @@ if (YDB_SDK_TESTS) LABELS unit TEST_ARG - --filter-file filter.txt - ) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/random/filter.txt - "-TestCommonRNG::TestStlCompatibility" + -TestCommonRNG::TestStlCompatibility ) add_ydb_test(NAME util-stream-ut diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp index b92697e1d0..ba2b602452 100644 --- a/util/generic/buffer.cpp +++ b/util/generic/buffer.cpp @@ -94,6 +94,7 @@ TBuffer::~TBuffer() { } void TBuffer::AsString(TString& s) { - s.assign(Data(), Size()); + Y_ASSERT(Data() != nullptr || Size() == 0); + s.assign(Data() == nullptr ? "" : Data(), Size()); Clear(); }