mirror of https://github.com/google/oss-fuzz.git
[infra] Support extra arguments for llvm-cov + update the binaries. (#1629)
* [infra] Support extra arguments for llvm-cov + update the binaries. * Slightly change the doc to be less confusing.
This commit is contained in:
parent
cf9860b876
commit
645a0375fe
|
@ -72,6 +72,17 @@ via `--corpus-dir` to be used instead of the corpus downloaded from OSS-Fuzz:
|
|||
python infra/helper.py profile --fuzz-target=<fuzz_target_name> --corpus-dir=<my_local_corpus_dir> $project_name
|
||||
```
|
||||
|
||||
### 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 `--`:
|
||||
|
||||
```bash
|
||||
python infra/helper.py profile $project_name -- -ignore-filename-regex='.*code/to/be/ignored/.*' -tab-size=2
|
||||
```
|
||||
|
||||
|
||||
[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
|
||||
|
|
|
@ -23,7 +23,10 @@ else
|
|||
fi
|
||||
|
||||
LOGS_DIR="$OUT/logs"
|
||||
mkdir -p $LOGS_DIR
|
||||
rm -rf $LOGS_DIR && mkdir -p $LOGS_DIR
|
||||
|
||||
REPORT_DIR="$OUT/report"
|
||||
rm -rf $REPORT_DIR
|
||||
|
||||
# This will be used by llvm-cov command to generate the actual report.
|
||||
objects=""
|
||||
|
@ -75,10 +78,10 @@ rm *.profraw
|
|||
# TODO(mmoroz): add script from Chromium for rendering directory view reports.
|
||||
|
||||
# Generate HTML report.
|
||||
llvm-cov show -format=html -output-dir=report -path-equivalence="/,$OUT" \
|
||||
-instr-profile merged.profdata $objects
|
||||
llvm-cov show -format=html -output-dir=$REPORT_DIR -path-equivalence="/,$OUT" \
|
||||
$COVERAGE_EXTRA_ARGS -instr-profile merged.profdata $objects
|
||||
|
||||
# Serve the report locally.
|
||||
echo "Serving the report on http://127.0.0.1:$HTTP_PORT/"
|
||||
cd report
|
||||
cd $REPORT_DIR
|
||||
python3 -m http.server $HTTP_PORT
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -122,7 +122,6 @@ def main():
|
|||
|
||||
profile_parser = subparsers.add_parser(
|
||||
'profile', help='Generate code coverage report for the project.')
|
||||
profile_parser.add_argument('project_name', help='name of the project')
|
||||
profile_parser.add_argument('--no-corpus-download', action='store_true',
|
||||
help='do not download corpus backup from OSS-Fuzz; '
|
||||
'use corpus located in build/corpus/<project>/<fuzz_target>/')
|
||||
|
@ -132,6 +131,9 @@ def main():
|
|||
'target to be run for generating coverage report')
|
||||
profile_parser.add_argument('--corpus-dir', help='specify location of corpus '
|
||||
'to be used (requires --fuzz-target argument)')
|
||||
profile_parser.add_argument('project_name', help='name of the project')
|
||||
profile_parser.add_argument('extra_args', help='additional arguments to '
|
||||
'pass to llvm-cov utility.', nargs='*')
|
||||
|
||||
reproduce_parser = subparsers.add_parser(
|
||||
'reproduce', help='Reproduce a crash.')
|
||||
|
@ -621,6 +623,7 @@ def profile(args):
|
|||
'PROJECT=%s' % args.project_name,
|
||||
'SANITIZER=profile',
|
||||
'HTTP_PORT=%s' % args.port,
|
||||
'COVERAGE_EXTRA_ARGS=%s' % ' '.join(args.extra_args),
|
||||
]
|
||||
|
||||
run_args = _env_to_docker_args(env)
|
||||
|
|
Loading…
Reference in New Issue