-
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 20 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 |
|---|---|---|
|
|
@@ -94,16 +94,31 @@ jobs: | |
| dependsOn: ["format"] | ||
| timeoutInMinutes: 360 | ||
| pool: "x64-large" | ||
| strategy: | ||
| maxParallel: 2 | ||
| matrix: | ||
| coverage: | ||
| CI_TARGET: "bazel.coverage" | ||
|
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. make this CI_TARGET: "coverage"/"fuzz_coverage" then you can use it in upload step as well?
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. Can you make this as displayName: "Linux-x64" in line 93? then the GH check name should match existing. |
||
| fuzz_coverage: | ||
| CI_TARGET: "bazel.fuzz_coverage" | ||
| steps: | ||
| - template: bazel.yml | ||
| parameters: | ||
| managedAgent: false | ||
| ciTarget: bazel.coverage | ||
| ciTarget: $(CI_TARGET) | ||
| rbe: "" | ||
| bazelBuildExtraOptions: "--test_env=ENVOY_IP_TEST_VERSIONS=v4only --curses=no" | ||
|
|
||
| - script: ci/run_envoy_docker.sh 'ci/upload_gcs_artifact.sh /build/envoy/generated/coverage coverage' | ||
| displayName: "Upload Report to GCS" | ||
| displayName: "Upload Coverage Report to GCS" | ||
| env: | ||
| ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory) | ||
| GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey) | ||
| GCS_ARTIFACT_BUCKET: $(GcsArtifactBucket) | ||
| condition: always() | ||
|
|
||
| - script: ci/run_envoy_docker.sh 'ci/upload_gcs_artifact.sh /build/envoy/generated/fuzz_coverage fuzz_coverage' | ||
| displayName: "Upload Fuzz Coverage Report to GCS" | ||
| env: | ||
| ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory) | ||
| GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -571,21 +571,31 @@ test/run_envoy_bazel_coverage.sh | |
| The summary results are printed to the standard output and the full coverage | ||
| report is available in `generated/coverage/coverage.html`. | ||
|
|
||
| To generate coverage results for fuzz targets, use the `FUZZ_COVERAGE` environment variable, e.g.: | ||
| ``` | ||
| FUZZ_COVERAGE=true VALIDATE_COVERAGE=false test/run_envoy_bazel_coverage.sh | ||
| ``` | ||
| This generates a coverage report for fuzz targets after running the target for one minute against fuzzing engine libfuzzer using its coprus as initial seed inputs. The full coverage report will be available in `generated/fuzz_coverage/coverage.html`. | ||
|
|
||
| Coverage for every PR is available in Circle in the "artifacts" tab of the coverage job. You will | ||
| need to navigate down and open "coverage.html" but then you can navigate per normal. NOTE: We | ||
| have seen some issues with seeing the artifacts tab. If you can't see it, log out of Circle, and | ||
| then log back in and it should start working. | ||
|
|
||
| The latest coverage report for master is available | ||
| [here](https://storage.googleapis.com/envoy-coverage/report-master/index.html). | ||
| [here](https://storage.googleapis.com/envoy-coverage/report-master/index.html). The latest fuzz coverage report for master is available [here](https://storage.googleapis.com/envoy-fuzz-coverage/report-master/index.html) | ||
|
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. merge master, this should be in https://storage.googleapis.com/envoy-postsubmit/master/fuzz_coverage/index.html |
||
|
|
||
| It's also possible to specialize the coverage build to a specified test or test dir. This is useful | ||
| when doing things like exploring the coverage of a fuzzer over its corpus. This can be done by | ||
| passing coverage targets as the command-line arguments and using the `VALIDATE_COVERAGE` environment | ||
| variable, e.g.: | ||
|
|
||
| ``` | ||
| VALIDATE_COVERAGE=false test/run_envoy_bazel_coverage.sh //test/common/common:base64_fuzz_test | ||
| VALIDATE_COVERAGE=false test/run_envoy_bazel_coverage.sh //test/common/common:base64_test | ||
| ``` | ||
| For fuzz targets, you will need to include the `FUZZ_COVERAGE` environment variable, e.g.: | ||
| ``` | ||
| FUZZ_COVERAGE=true VALIDATE_COVERAGE=false test/run_envoy_bazel_coverage.sh //test/common/common:base64_fuzz_test | ||
| ``` | ||
|
|
||
| # Cleaning the build and test artifacts | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,6 +272,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 | ||
|
|
||
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.