From 07e93b35dce77807e47a0d2e73413b2f4d3fcad5 Mon Sep 17 00:00:00 2001 From: hxy7yx <1595670487@qq.com> Date: Thu, 31 Aug 2023 15:28:10 +0800 Subject: [PATCH] Unit Test Coverage Statistics --- CMakeLists.txt | 1 + tests/README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abf2c0b8..d545ff00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ if(USE_GCOV) SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage") SET(GCC_COVERAGE_LINK_FLAGS "-lgcov") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}") endif(USE_GCOV) diff --git a/tests/README.md b/tests/README.md index 5f5619a8..87fedecf 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,7 +16,7 @@ Generate image files .gcno and data files .gcda under build/tests/CMakeFiles/.di Execute the following command in the build folder to generate an intermediate file for HTML: ```shell -$ lcov --capture --directory . -- output-file testneuron.info --test-name testneuron +$ lcov --capture --directory . --output-file testneuron.info --test-name testneuron ``` Execute the following command in the build folder to generate an HTML file in the result folder under the build folder: