-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[fuzz] add fuzz coverage CI check #11045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 48 commits
6cf628a
b1e585f
1c4a2db
c30d149
89b95da
ef0701c
f9266bb
9e4b175
da63fbb
2ce6603
baa334f
90f49ab
d8e804e
b0588cc
b1b3f54
874b806
056c439
0c61268
0a9b839
4b8548a
37130ee
afbcd2b
2c21084
0bd3e81
2586e40
b8ac2a2
48a423f
a183518
463234c
1a0ef25
afa8b13
2df8337
c0f293f
7cebc32
08a0531
7a6f975
6b0354c
11850bf
25bac35
ad35385
aebe031
3b2dddd
4d3598c
cb9b593
59ce7c4
a33f522
d77c18b
bbaaf58
a4e3e2f
f94c392
7ea6e16
4a212b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,6 +269,18 @@ elif [[ "$CI_TARGET" == "bazel.coverage" ]]; then | |
| test/run_envoy_bazel_coverage.sh ${COVERAGE_TEST_TARGETS} | ||
| collect_build_profile coverage | ||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "bazel.fuzz_coverage" ]]; then | ||
| setup_clang_toolchain | ||
| echo "bazel coverage build with fuzz tests ${COVERAGE_TEST_TARGETS}" | ||
|
|
||
| # Reduce the amount of memory Bazel tries to use to prevent it from launching too many subprocesses. | ||
| # This should prevent the system from running out of memory and killing tasks. See discussion on | ||
| # https://github.com/envoyproxy/envoy/pull/5611. | ||
| [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288" | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| FUZZ_COVERAGE=true test/run_envoy_bazel_coverage.sh ${COVERAGE_TEST_TARGETS} | ||
| collect_build_profile coverage | ||
| exit 0 | ||
| elif [[ "$CI_TARGET" == "bazel.clang_tidy" ]]; then | ||
| setup_clang_toolchain | ||
| NUM_CPUS=$NUM_CPUS ci/run_clang_tidy.sh | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,14 @@ elif [[ -n "${COVERAGE_TARGET}" ]]; then | |
| COVERAGE_TARGETS=${COVERAGE_TARGET} | ||
| else | ||
| # For fuzz builds, this overrides to just fuzz targets. | ||
| COVERAGE_TARGETS=//test/... && [[ ${FUZZ_COVERAGE} == "true" ]] && | ||
| COVERAGE_TARGETS="$(bazel query 'attr("tags", "fuzz_target", //test/...)')" | ||
| COVERAGE_TARGETS=//test/... | ||
| fi | ||
|
|
||
| if [[ "${FUZZ_COVERAGE}" == "true" ]]; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This if has the same condition as the next if block. Can they be merged?
asraa marked this conversation as resolved.
|
||
| COVERAGE_TARGETS=$(bazel query "attr("tags", "fuzz_target", ${COVERAGE_TARGETS})") | ||
| fi | ||
| echo "COVERAGE_TARGETS=${COVERAGE_TARGETS}" | ||
|
|
||
| if [[ "${FUZZ_COVERAGE}" == "true" ]]; then | ||
| BAZEL_BUILD_OPTIONS+=" --config=fuzz-coverage --test_tag_filters=-nocoverage" | ||
| else | ||
|
|
@@ -36,7 +40,7 @@ bazel coverage ${BAZEL_BUILD_OPTIONS} ${COVERAGE_TARGETS} | |
| [[ -z "${ENVOY_BUILD_PROFILE}" ]] || cp -f "$(bazel info output_base)/command.profile.gz" "${ENVOY_BUILD_PROFILE}/coverage.profile.gz" || true | ||
| [[ -z "${ENVOY_BUILD_DIR}" ]] || find bazel-testlogs/ -name test.log | tar zcf "${ENVOY_BUILD_DIR}/testlogs.tar.gz" -T - | ||
|
|
||
| COVERAGE_DIR="${SRCDIR}"/generated/coverage | ||
| COVERAGE_DIR="${SRCDIR}"/generated/coverage && [[ ${FUZZ_COVERAGE} == "true" ]] && COVERAGE_DIR="${SRCDIR}"/generated/fuzz_coverage | ||
|
|
||
| rm -rf "${COVERAGE_DIR}" | ||
| mkdir -p "${COVERAGE_DIR}" | ||
|
|
@@ -47,7 +51,12 @@ cp bazel-out/_coverage/_coverage_report.dat "${COVERAGE_DATA}" | |
| COVERAGE_VALUE=$(genhtml --prefix ${PWD} --output "${COVERAGE_DIR}" "${COVERAGE_DATA}" | tee /dev/stderr | grep lines... | cut -d ' ' -f 4) | ||
| COVERAGE_VALUE=${COVERAGE_VALUE%?} | ||
|
|
||
| [[ -z "${ENVOY_COVERAGE_ARTIFACT}" ]] || tar zcf "${ENVOY_COVERAGE_ARTIFACT}" -C ${COVERAGE_DIR} --transform 's/^\./coverage/' . | ||
| if [ "${FUZZ_COVERAGE}" == "true" ] | ||
| then | ||
| [[ -z "${ENVOY_FUZZ_COVERAGE_ARTIFACT}" ]] || tar zcf "${ENVOY_FUZZ_COVERAGE_ARTIFACT}" -C ${COVERAGE_DIR} --transform 's/^\./fuzz_coverage/' . | ||
| else | ||
| [[ -z "${ENVOY_COVERAGE_ARTIFACT}" ]] || tar zcf "${ENVOY_COVERAGE_ARTIFACT}" -C ${COVERAGE_DIR} --transform 's/^\./coverage/' . | ||
| fi | ||
|
|
||
| if [[ "$VALIDATE_COVERAGE" == "true" ]]; then | ||
| if [[ "${FUZZ_COVERAGE}" == "true" ]]; then | ||
|
|
@@ -66,7 +75,7 @@ fi | |
|
|
||
| # We want to allow per_file_coverage to fail without exiting this script. | ||
| set +e | ||
| if [[ "$VALIDATE_COVERAGE" == "true" ]]; then | ||
| if [[ "$VALIDATE_COVERAGE" == "true" ]] && [[ "{FUZZ_COVERAGE}" == "false"]]; then | ||
| echo "Checking per-extension coverage" | ||
| output=$(./test/per_file_coverage.sh) | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.