Skip to content

Commit

Permalink
ADD CLEAN_COVERAGE_MACRO in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Aug 23, 2024
1 parent 8f46ec1 commit abe12d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
2 changes: 2 additions & 0 deletions doc/manuals/admin/build_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,5 @@ You can generate coverage reports for the Orion Context Broker using the followi
* Run coverage

make coverage INSTALL_DIR=~

*NOTE*: note that functional test relying in debug traces are expected to fail under coverage execution (this is due to the LM_T macros used by the debug traces are disabled in the coverage code building, due to they add "noise" in condition coverage, thus making coverage reports more useful).
41 changes: 16 additions & 25 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ ifndef MONGO_HOST
MONGO_HOST=localhost
endif

# Macros
define CLEAN_COVERAGE_REPORT
lcov -r coverage/broker.info "/usr/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/usr/local/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/opt/local/include/google/*" -o coverage/broker.info
# Remove unit test libraries and libraries developed before contextBroker project init
lcov -r coverage/broker.info "*/test/unittests/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/logMsg/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/parseArgs/*" -o coverage/broker.info
# app/ contains application itself, not libraries which make sense to measure unit_test coverage
lcov -r coverage/broker.info "*/src/app/*" -o coverage/broker.info
endef

all: prepare_release release

di: install_debug
Expand Down Expand Up @@ -242,15 +255,7 @@ coverage: coverage_functional_test coverage_unit_test
# Generate test report
echo "Generating coverage report"
lcov --add-tracefile BUILD_UNITTEST/coverage.info --add-tracefile BUILD_COVERAGE/coverage.info --output-file coverage/broker.info
lcov -r coverage/broker.info "/usr/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/usr/local/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/opt/local/include/google/*" -o coverage/broker.info
# Remove unit test libraries and libraries developed before contextBroker project init
lcov -r coverage/broker.info "*/test/unittests/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/logMsg/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/parseArgs/*" -o coverage/broker.info
# app/ contains application itself, not libraries which make sense to measure unit_test coverage
lcov -r coverage/broker.info "*/src/app/*" -o coverage/broker.info
$(CLEAN_COVERAGE_REPORT)
genhtml -o coverage coverage/broker.info

coverage_unit_test: build_unit_test_coverage
Expand All @@ -266,15 +271,7 @@ coverage_unit_test: build_unit_test_coverage
echo "Generating coverage report"
lcov --directory BUILD_UNITTEST --capture -b BUILD_UNITTEST --output-file coverage/broker.test.info
lcov --add-tracefile coverage/broker.init.info --add-tracefile coverage/broker.test.info --output-file coverage/broker.info
lcov -r coverage/broker.info "/usr/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/usr/local/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/opt/local/include/google/*" -o coverage/broker.info
# Remove unit test libraries and libraries developed before contextBroker project init
lcov -r coverage/broker.info "*/test/unittests/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/logMsg/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/parseArgs/*" -o coverage/broker.info
# app/ contains application itself, not libraries which make sense to measure unit_test coverage
lcov -r coverage/broker.info "*/src/app/*" -o coverage/broker.info
$(CLEAN_COVERAGE_REPORT)
genhtml -o coverage coverage/broker.info

coverage_functional_test: install_coverage
Expand All @@ -300,13 +297,7 @@ coverage_functional_test: install_coverage
echo "Generating coverage report"
lcov --directory BUILD_COVERAGE --capture -b BUILD_COVERAGE --output-file coverage/broker.test.info
lcov --add-tracefile coverage/broker.init.info --add-tracefile coverage/broker.test.info --output-file coverage/broker.info
lcov -r coverage/broker.info "/usr/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/usr/local/include/*" -o coverage/broker.info
lcov -r coverage/broker.info "/opt/local/include/google/*" -o coverage/broker.info
# Remove unit test libraries and libraries developed before contextBroker project init
lcov -r coverage/broker.info "*/test/unittests/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/logMsg/*" -o coverage/broker.info
lcov -r coverage/broker.info "*/src/lib/parseArgs/*" -o coverage/broker.info
$(CLEAN_COVERAGE_REPORT)
genhtml -o coverage coverage/broker.info

valgrind: install_debug
Expand Down

0 comments on commit abe12d2

Please sign in to comment.