diff --git a/.ci/publish_coverage.sh b/.ci/publish_coverage.sh index 0189ae770f..1b9ad71ac7 100755 --- a/.ci/publish_coverage.sh +++ b/.ci/publish_coverage.sh @@ -49,7 +49,10 @@ for file in `ls $ARTIFACT_FOLDER | grep ".info"`; do done -lcov $ARGS --output-file /tmp/coverage.info +lcov $ARGS --output-file /tmp/coverage_temp.info + +# filter out unwanted files +lcov --remove /tmp/coverage_temp.info "*eth_*" --output-file /tmp/coverage.info || echo "$0: coverage tracefile is empty" genhtml --title "MRS UAV System - Test coverage report" --demangle-cpp --legend --frames --show-details -o /tmp/coverage_html /tmp/coverage.info | tee /tmp/coverage.log diff --git a/.ci/test.sh b/.ci/test.sh index d61695eedd..c820ce0b8f 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -121,8 +121,13 @@ if [[ "$FAILED" -eq 0 ]]; then echo "$0: storing coverage data" + # gather all the coverage data from the workspace lcov --capture --directory ${WORKSPACE} --output-file /tmp/coverage.original - lcov --remove /tmp/coverage.original "*/test/*" "*/*eth_*/*" --output-file /tmp/coverage.removed || echo "$0: coverage tracefile is empty" + + # filter out unwanted files, i.e., test files + lcov --remove /tmp/coverage.original "*/test/*" --output-file /tmp/coverage.removed || echo "$0: coverage tracefile is empty" + + # extract coverage data for the source folder of the workspace lcov --extract /tmp/coverage.removed "$WORKSPACE/src/*" --output-file $ARTIFACT_FOLDER/$REPOSITORY_NAME.info || echo "$0: coverage tracefile is empty" fi