Skip to content
Snippets Groups Projects
Commit 4cf29418 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

fix

parent abccf0d5
No related branches found
No related tags found
No related merge requests found
...@@ -105,8 +105,10 @@ function(gtest target test_source_files linktarget) ...@@ -105,8 +105,10 @@ function(gtest target test_source_files linktarget)
set_tests_properties(test-${target} PROPERTIES LABELS "unit;all") set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
message(STATUS "Added test 'test-${target}'") message(STATUS "Added test 'test-${target}'")
if (ARGN)
if (CMAKE_COMPILER_IS_GNUCXX) LIST(GET ${ARGN} 0 NOCOV)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*") set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*")
if (ARGN) if (ARGN)
set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN}) set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
...@@ -116,6 +118,8 @@ function(gtest target test_source_files linktarget) ...@@ -116,6 +118,8 @@ function(gtest target test_source_files linktarget)
COMMAND ${CMAKE_MODULE_PATH}/check_test.sh COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
coverage-${target} ${CMAKE_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE}) coverage-${target} ${CMAKE_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE})
set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all") set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all")
message(STATUS "Added test 'test-${target}-coverage'")
SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target}) SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
......
...@@ -27,5 +27,5 @@ set(TEST_SOURCE_FILES ../../unittests/database/test_encoding.cpp) ...@@ -27,5 +27,5 @@ set(TEST_SOURCE_FILES ../../unittests/database/test_encoding.cpp)
set(TEST_LIBRARIES "${TARGET_NAME}") set(TEST_LIBRARIES "${TARGET_NAME}")
include_directories(${ASAPO_CXX_COMMON_INCLUDE_DIR}) include_directories(${ASAPO_CXX_COMMON_INCLUDE_DIR})
gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "*mongodb_client*" "*database.*") gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "nocov")
...@@ -85,9 +85,14 @@ std::string EncodeColName(const std::string &colname) { ...@@ -85,9 +85,14 @@ std::string EncodeColName(const std::string &colname) {
} }
std::string DecodeName(const std::string &name) { std::string DecodeName(const std::string &name) {
std::unique_ptr<char>decoded{new char(name.size())}; char* decoded = new char[name.size() + 1];
auto res = decode(name.c_str(), decoded.get()); auto res = decode(name.c_str(), decoded);
return res >= 0 ? decoded.get() : ""; if (res < 0) {
return "";
}
std::string str = std::string{decoded};
delete[] decoded;
return str;
} }
bool ShouldEscapeQuery(char c) { bool ShouldEscapeQuery(char c) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment