diff options
author | 2020-03-11 00:49:10 +0100 | |
---|---|---|
committer | 2020-03-10 16:49:10 -0700 | |
commit | 3c248cdc57eb7cc2b802aa472204131a1c5fbb91 (patch) | |
tree | d51f3f59fa651e6f4d9ade5ed373de1e0f79b6bf /infra/helper.py | |
parent | e58ee49e2029a2ddaf3a801b1332b1677e6854f8 (diff) |
[infra] helper: Add possibility to pass source directory to gdb/shell commands to ease local debugging (#3465)
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'infra/helper.py')
-rwxr-xr-x | infra/helper.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/infra/helper.py b/infra/helper.py index 5a3880b5..24427a94 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -171,6 +171,9 @@ def main(): # pylint: disable=too-many-branches,too-many-return-statements,too- shell_parser = subparsers.add_parser( 'shell', help='Run /bin/bash within the builder container.') shell_parser.add_argument('project_name', help='name of the project') + shell_parser.add_argument('source_path', + help='path of local source', + nargs='?') _add_architecture_args(shell_parser) _add_engine_args(shell_parser) _add_sanitizer_args(shell_parser) @@ -867,12 +870,19 @@ def shell(args): image_project = 'oss-fuzz' out_dir = _get_output_dir(args.project_name) - run_args = _env_to_docker_args(env) + [ + run_args = _env_to_docker_args(env) + if args.source_path: + run_args.extend([ + '-v', + '%s:%s' % (_get_absolute_path(args.source_path), '/src'), + ]) + + run_args.extend([ '-v', '%s:/out' % out_dir, '-v', '%s:/work' % _get_work_dir(args.project_name), '-t', 'gcr.io/%s/%s' % (image_project, args.project_name), '/bin/bash' - ] + ]) docker_run(run_args) return 0 |