Skip to content

Commit

Permalink
Add a --no-serve option to the helper coverage command. (google#10628)
Browse files Browse the repository at this point in the history
This turns off the http report serving after a successful generation.
  • Loading branch information
oliverchang committed Jul 3, 2023
1 parent 9fca681 commit aca1497
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions infra/base-images/base-runner/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,16 @@ else

generate_html $profdata_path "$shared_libraries" "$fuzz_target" "$report_dir"
done

set +e
fi

# Make sure report is readable.
chmod -R +r $REPORT_ROOT_DIR $REPORT_BY_TARGET_ROOT_DIR
find $REPORT_ROOT_DIR $REPORT_BY_TARGET_ROOT_DIR -type d -exec chmod +x {} +

# HTTP_PORT is optional.
set +u
if [[ -n $HTTP_PORT ]]; then
# Serve the report locally.
echo "Serving the report on http://127.0.0.1:$HTTP_PORT/linux/index.html"
Expand Down
7 changes: 6 additions & 1 deletion infra/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ def get_parser(): # pylint: disable=too-many-statements,too-many-locals
help='do not download corpus backup from '
'OSS-Fuzz; use corpus located in '
'build/corpus/<project>/<fuzz_target>/')
coverage_parser.add_argument('--no-serve',
action='store_true',
help='do not serve a local HTTP server.')
coverage_parser.add_argument('--port',
default='8008',
help='specify port for'
Expand Down Expand Up @@ -1207,11 +1210,13 @@ def coverage(args):
'FUZZING_LANGUAGE=%s' % args.project.language,
'PROJECT=%s' % args.project.name,
'SANITIZER=coverage',
'HTTP_PORT=%s' % args.port,
'COVERAGE_EXTRA_ARGS=%s' % ' '.join(args.extra_args),
'ARCHITECTURE=' + args.architecture,
]

if not args.no_serve:
env.append(f'HTTP_PORT={args.port}')

run_args = _env_to_docker_args(env)

if args.port:
Expand Down

0 comments on commit aca1497

Please sign in to comment.