From fb5ebac7302b551efd270a8bf61b871bc1bbc0d2 Mon Sep 17 00:00:00 2001 From: zhiru Date: Sat, 7 Sep 2019 14:43:46 +0800 Subject: [PATCH 1/2] Install core unit test and add to coverage Former-commit-id: cdd16a8ff94ab77538f17ffa322c19c5a13804ac --- cpp/CHANGELOG.md | 2 +- cpp/coverage.sh | 2 +- cpp/src/core/CMakeLists.txt | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 01e065ed07..b50a7e90fc 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -92,7 +92,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-487 - Define metric type in CreateTable - MS-488 - Improve code format in scheduler - MS-495 - cmake: integrated knowhere -- MS-505 - Install core unit test +- MS-505 - Install core unit test and add to coverage ## New Feature - MS-343 - Implement ResourceMgr diff --git a/cpp/coverage.sh b/cpp/coverage.sh index 970394116e..dd4894f6fd 100755 --- a/cpp/coverage.sh +++ b/cpp/coverage.sh @@ -94,7 +94,7 @@ ${LCOV_CMD} -r "${FILE_INFO_OUTPUT}" -o "${FILE_INFO_OUTPUT_NEW}" \ "/usr/*" \ "*/boost/*" \ "*/cmake_build/*_ep-prefix/*" \ - "src/core/cmake_build*" \ + "src/core/thirdparty*" \ # gen html report ${LCOV_GEN_CMD} "${FILE_INFO_OUTPUT_NEW}" --output-directory ${DIR_LCOV_OUTPUT}/ \ No newline at end of file diff --git a/cpp/src/core/CMakeLists.txt b/cpp/src/core/CMakeLists.txt index 890c7ed4d1..d406f41ce3 100644 --- a/cpp/src/core/CMakeLists.txt +++ b/cpp/src/core/CMakeLists.txt @@ -72,6 +72,10 @@ include(ThirdPartyPackagesCore) add_subdirectory(src) +if (BUILD_COVERAGE STREQUAL "ON") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") +endif() + set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE) if(BUILD_UNIT_TEST STREQUAL "ON") From a4228e805be85092be10bc93e83b9ec161c88f98 Mon Sep 17 00:00:00 2001 From: zhiru Date: Sat, 7 Sep 2019 14:45:28 +0800 Subject: [PATCH 2/2] update Former-commit-id: 0bd73290587cc8abb50ba038a72c3ba0f0097785 --- cpp/coverage.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/coverage.sh b/cpp/coverage.sh index dd4894f6fd..701416921f 100755 --- a/cpp/coverage.sh +++ b/cpp/coverage.sh @@ -94,6 +94,7 @@ ${LCOV_CMD} -r "${FILE_INFO_OUTPUT}" -o "${FILE_INFO_OUTPUT_NEW}" \ "/usr/*" \ "*/boost/*" \ "*/cmake_build/*_ep-prefix/*" \ + "src/core/cmake_build*" \ "src/core/thirdparty*" \ # gen html report