Commit Graph

3 Commits

Author SHA1 Message Date
Yijie Ma bd940c0dd5
[Fuzzing] Add a build config option which enables Clang source-based code coverage (#32858)
This maybe used to quickly verify the code coverage of a modified test
locally (e.g. fuzzer).

Example:
```
# Build and run target; the raw profile will be written to $LLVM_PROFILE_FILE when the program exits
$ bazel build --config=dbg --config=fuzzer_asan --config=coverage //test/core/end2end/fuzzers:api_fuzzer
$ LLVM_PROFILE_FILE="api_fuzzer.profraw" bazel-bin/test/core/end2end/fuzzers/api_fuzzer test/core/end2end/fuzzers/api_fuzzer_corpus/*

# Create coverage report
$ llvm-profdata-14 merge -sparse api_fuzzer.profraw -o api_fuzzer.profdata
$ llvm-cov-14 report ./bazel-bin/test/core/end2end/fuzzers/api_fuzzer --instr-profile=api_fuzzer.profdata
```

Sample report:
f94e444f25/gistfile1.txt

One trick is that the binary needs to be statically linked, e.g. specify
`linkstatic = 1` on the BUILD target.
See https://clang.llvm.org/docs/SourceBasedCodeCoverage.html for more
info.



<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-04-14 13:03:12 -07:00
Craig Tiller ca7c17c8d4
[fixit] Make the sampling fuzzer always pass for now (#30718)
* [fixit] Make the sampling fuzzer always pass for now

* Update sample_fuzzers.sh
2022-08-23 16:50:10 -07:00
Craig Tiller 50ae54dd1c
[fuzzing] Run fuzzers a little bit as a test (#29919)
* [fuzzer] Add a script to sample fuzzers

* remember the script

* add ci

* bleh

* fix

* Update sample_fuzzers.sh

* tweak

* tweak

* tweak

* tweak

* tweak

* fix fuzzer found bug

* add explainer

* make it bold af

* limit max fuzzing time in addition to runs
2022-06-07 07:37:59 -07:00