Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,18 @@ https://github.com/bazelbuild/bazel/issues/2805.

# Coverage builds

To generate coverage results, make sure you are using a clang toolchain and have `llvm-cov` and
To generate coverage results, make sure you are using a Clang toolchain and have `llvm-cov` and
`llvm-profdata` in your `PATH`. Then run:

```
test/run_envoy_bazel_coverage.sh
```

**Note** that it is important to ensure that the versions of `clang`, `llvm-cov` and `llvm-profdata`
Comment thread
htuch marked this conversation as resolved.
are consistent and that they match the most recent Clang/LLVM toolchain version in use by Envoy (see
the [build container
toolchain](https://github.com/envoyproxy/envoy-build-tools/blob/master/build_container/build_container_ubuntu.sh) for reference).

The summary results are printed to the standard output and the full coverage
report is available in `generated/coverage/coverage.html`.

Expand Down
16 changes: 16 additions & 0 deletions test/run_envoy_bazel_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

set -e

LLVM_VERSION="10.0.0"
CLANG_VERSION=$(clang --version | grep version | sed -e 's/\ *clang version \(.*\)\ /\1/')
LLVM_COV_VERSION=$(llvm-cov --version | grep version | sed -e 's/\ *LLVM version \(.*\)/\1/')

if [ "${CLANG_VERSION}" != "${LLVM_VERSION}" ]
then
echo "clang version ${CLANG_VERSION} does not match expected ${LLVM_VERSION}"
exit 1
fi

if [ "${LLVM_COV_VERSION}" != "${LLVM_VERSION}" ]
then
echo "llvm-cov version ${LLVM_COV_VERSION} does not match expected ${LLVM_VERSION}"
exit 1
fi

[[ -z "${SRCDIR}" ]] && SRCDIR="${PWD}"
[[ -z "${VALIDATE_COVERAGE}" ]] && VALIDATE_COVERAGE=true
[[ -z "${FUZZ_COVERAGE}" ]] && FUZZ_COVERAGE=false
Expand Down