mirror of https://github.com/google/oss-fuzz.git
* [infra] Support extra coverage args in project.yaml (fix #1726, follow-up #1547). * Update the documentation page. * Fix review comments by Jonathan.
This commit is contained in:
parent
ed900e11a7
commit
733c896ce5
|
@ -87,20 +87,27 @@ python infra/helper.py profile --fuzz-target=<fuzz_target_name> --corpus-dir=<my
|
|||
### Additional arguments for `llvm-cov`
|
||||
|
||||
You may want to use some of the options of [llvm-cov tool], for example,
|
||||
`-ignore-filename-regex=` or `-tab-size=`. You can pass those to the helper
|
||||
script after `--`:
|
||||
`-ignore-filename-regex=`. You can pass those to the helper script after `--`:
|
||||
|
||||
```bash
|
||||
python infra/helper.py profile $project_name -- -ignore-filename-regex='.*code/to/be/ignored/.*' -tab-size=2
|
||||
python infra/helper.py profile $project_name -- -ignore-filename-regex=.*code/to/be/ignored/.* <other_extra_args>
|
||||
```
|
||||
|
||||
To specify particular source files to be shown in the report, list the filepaths
|
||||
at the end of the extra arguments sequence, for example:
|
||||
To specify particular source files or directories to show in the report, list
|
||||
their paths at the end of the extra arguments sequence, for example:
|
||||
|
||||
```bash
|
||||
python infra/helper.py profile zlib -- -tab-size=8 /src/zlib/inftrees.c /src/zlib_uncompress_fuzzer.cc /src/zlib/zutil.c
|
||||
python infra/helper.py profile zlib -- <other_extra_args> /src/zlib/inftrees.c /src/zlib_uncompress_fuzzer.cc /src/zlib/zutil.c
|
||||
```
|
||||
|
||||
If you want OSS-Fuzz to use some extra arguments when generating code coverage
|
||||
reports for your project, add the arguments into `project.yaml` file as follows:
|
||||
|
||||
```yaml
|
||||
coverage_extra_args: -ignore-filename-regex=.*crc.* -ignore-filename-regex=.*adler.* <other_extra_args>
|
||||
```
|
||||
|
||||
|
||||
[Clang Source-based Code Coverage]: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
||||
[gsutil tool]: https://cloud.google.com/storage/docs/gsutil_install
|
||||
[llvm-cov tool]: https://llvm.org/docs/CommandGuide/llvm-cov.html
|
||||
|
|
|
@ -135,7 +135,10 @@ def get_build_steps(project_dir):
|
|||
# Unpack the corpus and run coverage script.
|
||||
{
|
||||
'name': 'gcr.io/oss-fuzz-base/base-runner',
|
||||
'env': env + ['HTTP_PORT=', 'COVERAGE_EXTRA_ARGS='],
|
||||
'env': env + [
|
||||
'HTTP_PORT=',
|
||||
'COVERAGE_EXTRA_ARGS=%s' % project_yaml['coverage_extra_args']
|
||||
],
|
||||
'args': [
|
||||
'bash',
|
||||
'-c',
|
||||
|
|
|
@ -83,6 +83,7 @@ def load_project_yaml(project_dir):
|
|||
project_yaml.setdefault('sanitizers', DEFAULT_SANITIZERS)
|
||||
project_yaml.setdefault('fuzzing_engines', DEFAULT_ENGINES)
|
||||
project_yaml.setdefault('run_tests', True)
|
||||
project_yaml.setdefault('coverage_extra_args', '')
|
||||
return project_yaml
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue