File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,11 @@ set(CMAKE_MODULE_PATH
8585set (CMAKE_CXX_STANDARD 17)
8686set (CMAKE_CXX_STANDARD_REQUIRED True )
8787
88+ if (COVERAGE_ENABLED)
89+ # Add code coverage
90+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage" )
91+ endif ()
92+
8893# include(fb_cxx_flags)
8994message (STATUS "Update CXXFLAGS: ${CMAKE_CXX_FLAGS} " )
9095
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Build CacheLib with flag -DCOVERAGE_ENABLED=ON
4+
5+ # Track coverage
6+ lcov -c -i -b . -d . -o Coverage.baseline
7+ ./run_tests.sh
8+ lcov -c -d . -b . -o Coverage.out
9+ lcov -a Coverage.baseline -a Coverage.out -o Coverage.combined
10+
11+ # Generate report
12+ COVERAGE_DIR=' coverage_report'
13+ genhtml Coverage.combined -o ${COVERAGE_DIR}
14+ COVERAGE_REPORT=" ${COVERAGE_DIR} .tgz"
15+ tar -zcvf ${COVERAGE_REPORT} ${COVERAGE_DIR}
16+ echo " Created coverage report ${COVERAGE_REPORT} "
17+
18+ # Cleanup
19+ rm Coverage.baseline Coverage.out Coverage.combined
20+ rm -rf ${COVERAGE_DIR}
You can’t perform that action at this time.
0 commit comments