Skip to content

Commit

Permalink
Enable CODE_COVERAGE_EXCLUDES for cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
agutenkunst authored and Briancbn committed Dec 7, 2021
1 parent 58d4b54 commit 23a1c4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions industrial_ci/src/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ function ici_combine_cpp_reports {
lcov --extract coverage.info "$(pwd)/src/$TARGET_REPO_NAME/*" \
--output-file coverage.info | grep -ve "^Extracting"
# Filter out test files
lcov --remove coverage.info "*/test/*" \
local excludes=()
ici_parse_env_array excludes CODE_COVERAGE_EXCLUDES
lcov --remove coverage.info "*/test/*" "${excludes[@]}" \
--output-file coverage.info | grep -ve "^removing"
# Some sed magic to remove identifiable absolute path
sed -i "s~$(pwd)/src/$TARGET_REPO_NAME/~~g" coverage.info
Expand Down Expand Up @@ -77,7 +79,7 @@ function ici_collect_coverage_report {
"${PYTHON_VERSION_NAME}-dev" "${PYTHON_VERSION_NAME}-wheel"
"${PYTHON_VERSION_NAME}" -m pip install coveralls
# Use coveragerc file used for coveralls ignore
printf "[report]\ninclude = \n\t%s/src/%s/*\nomit = \n\t*/test/*\n\t*/setup.py" "$target_ws" "$TARGET_REPO_NAME" \
printf "[report]\ninclude = \n\t%s/src/%s/*\nomit = \n\t*/test/*\n\t*/setup.py\n\t%s" "$target_ws" "$TARGET_REPO_NAME" "${CODE_COVERAGE_EXCLUDES/ /\\t\\n}" \
> "$target_ws/src/$TARGET_REPO_NAME/.default.coveragerc"
if [ -f "$target_ws"/coverage.info ]; then
# Install and run coveralls-lcov within git directory
Expand Down
1 change: 1 addition & 0 deletions industrial_ci/src/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export CCACHE_DIR=${CCACHE_DIR:-}
export CMAKE_ARGS=${CMAKE_ARGS:-}

export CODE_COVERAGE=${CODE_COVERAGE:-}
export CODE_COVERAGE_EXCLUDES=${CODE_COVERAGE_EXCLUDES:-}

export DOWNSTREAM_CMAKE_ARGS=${DOWNSTREAM_CMAKE_ARGS:-}
export DOWNSTREAM_WORKSPACE=${DOWNSTREAM_WORKSPACE:-}
Expand Down
1 change: 1 addition & 0 deletions industrial_ci/src/isolation/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CLANG_TIDY_BASE_REF
CLANG_TIDY_JOBS
CMAKE_ARGS
CODE_COVERAGE
CODE_COVERAGE_EXCLUDES
CPPFLAGS
CXX
CXXFLAGS
Expand Down

0 comments on commit 23a1c4a

Please sign in to comment.