Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Not for merging] Issue #166 Fix src/library/blockcodecs tests #317

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ cmake --build --preset release

## Test

Specify a level of parallelism by passing the `-j<level>` 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<level>` option into the commands below (e.g. `-j$(nproc)`).

Running all tests:

Expand All @@ -143,9 +150,5 @@ ctest -j$(nproc) --preset release-integration
Note that some tests use a legacy test library instead of GoogleTest, see `./<test_target> --help` for details. If you need to run only certain test cases, here is an alternative for `--gtest_filter` option:

```bash
cat <<EOF | ./<test_target> --filter-file /dev/fd/0
-ExcludedTestCase
+IncludedTestCase
+IncludedTestCase::TestName
EOF
./<test_target> -ExcludedTestSuite +IncludedTestSuite::TestName
```
21 changes: 18 additions & 3 deletions library/cpp/blockcodecs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion util/generic/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Loading