added architecture option to helper reproduce command (#9089)

Similar to #8972, reproducing seems to assume architecture and doesn't
allow specifying a target. This PR adds the `--architecture` flag to the
reproduce command, allowing reproduction in the target platform.

Tested by running `build_fuzzers` and then `reproduce` with defaults.
Now using `--architecture aarch64` works to reproduce.
This commit is contained in:
Raphael Salas 2022-12-12 18:52:14 -05:00 committed by GitHub
parent 974f255c29
commit 4dbcd5f3a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -365,6 +365,7 @@ def get_parser(): # pylint: disable=too-many-statements
nargs='*') nargs='*')
_add_environment_args(reproduce_parser) _add_environment_args(reproduce_parser)
_add_external_project_args(reproduce_parser) _add_external_project_args(reproduce_parser)
_add_architecture_args(reproduce_parser)
shell_parser = subparsers.add_parser( shell_parser = subparsers.add_parser(
'shell', help='Run /bin/bash within the builder container.') 'shell', help='Run /bin/bash within the builder container.')
@ -1074,7 +1075,7 @@ def run_fuzzer(args):
def reproduce(args): def reproduce(args):
"""Reproduces a specific test case from a specific project.""" """Reproduces a specific test case from a specific project."""
return reproduce_impl(args.project, args.fuzzer_name, args.valgrind, args.e, return reproduce_impl(args.project, args.fuzzer_name, args.valgrind, args.e,
args.fuzzer_args, args.testcase_path) args.fuzzer_args, args.testcase_path, args.architecture)
def reproduce_impl( # pylint: disable=too-many-arguments def reproduce_impl( # pylint: disable=too-many-arguments
@ -1084,6 +1085,7 @@ def reproduce_impl( # pylint: disable=too-many-arguments
env_to_add, env_to_add,
fuzzer_args, fuzzer_args,
testcase_path, testcase_path,
architecture='x86_64',
run_function=docker_run, run_function=docker_run,
err_result=False): err_result=False):
"""Reproduces a testcase in the container.""" """Reproduces a testcase in the container."""
@ -1094,7 +1096,7 @@ def reproduce_impl( # pylint: disable=too-many-arguments
return err_result return err_result
debugger = '' debugger = ''
env = ['HELPER=True'] env = ['HELPER=True', 'ARCHITECTURE=' + architecture]
image_name = 'base-runner' image_name = 'base-runner'
if valgrind: if valgrind:
@ -1119,7 +1121,7 @@ def reproduce_impl( # pylint: disable=too-many-arguments
'-runs=100', '-runs=100',
] + fuzzer_args ] + fuzzer_args
return run_function(run_args) return run_function(run_args, architecture=architecture)
def _validate_project_name(project_name): def _validate_project_name(project_name):