aboutsummaryrefslogtreecommitdiff
path: root/infra/helper.py
diff options
context:
space:
mode:
authorLeo Neat <leosneat@gmail.com>2020-01-06 12:17:26 -0800
committerMax Moroz <mmoroz@chromium.org>2020-01-06 12:17:26 -0800
commit9532d4781a8a7539591f6edc0b86e82786fffafa (patch)
tree8b70a7ceaa4904ac03d0af2455badf07fc0bcf99 /infra/helper.py
parent14bdd9332c0ae144dd24c9d09139c55a397f902d (diff)
downloadoss-fuzz-9532d4781a8a7539591f6edc0b86e82786fffafa.tar.gz
[infra] Fixing bisection to work with more OSS-Fuzz projects (#3152)
* Max comments * Added bisection tests * Added test cases * Docker run command added to build_specific commit * Infer main repo uses docker image rather than docker file * Added mores tests for repo infer * With verbosity * Formatting * Bisection fixed * Formatting updates * Oliver small comments. * Script infer main repo * Detect repo and test module finished * Detect main repo from script * Regex searching * Regex searching * Max comments + bisector test script * Oliver comments * Max's comments * String concat update * Jonathan comments
Diffstat (limited to 'infra/helper.py')
-rwxr-xr-xinfra/helper.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/infra/helper.py b/infra/helper.py
index 7e2d9ec80..bc3ee96c8 100755
--- a/infra/helper.py
+++ b/infra/helper.py
@@ -417,7 +417,7 @@ def build_image(args):
def build_fuzzers_impl(project_name, clean, engine, sanitizer, architecture,
- env_to_add, source_path, no_cache=False):
+ env_to_add, source_path, no_cache=False, mount_location=None):
"""Build fuzzers."""
if not build_image_impl(project_name, no_cache=no_cache):
return 1
@@ -432,7 +432,7 @@ def build_fuzzers_impl(project_name, clean, engine, sanitizer, architecture,
'-t', 'gcr.io/oss-fuzz/%s' % project_name,
'/bin/bash', '-c', 'rm -rf /out/*'
])
-
+
else:
print('Keeping existing build artifacts as-is (if any).')
env = [
@@ -459,13 +459,19 @@ def build_fuzzers_impl(project_name, clean, engine, sanitizer, architecture,
if source_path:
workdir = _workdir_from_dockerfile(project_name)
if workdir == '/src':
- print('Cannot use local checkout with "WORKDIR /src".', file=sys.stderr)
+ print('Cannot use local checkout with "WORKDIR: /src".', file=sys.stderr)
return 1
+ if not mount_location:
+ command += [
+ '-v',
+ '%s:%s' % (_get_absolute_path(source_path), workdir),
+ ]
+ else:
+ command += [
+ '-v',
+ '%s:%s' % (_get_absolute_path(source_path), mount_location),
+ ]
- command += [
- '-v',
- '%s:%s' % (_get_absolute_path(source_path), workdir),
- ]
command += [
'-v', '%s:/out' % project_out_dir,
'-v', '%s:/work' % project_work_dir,
@@ -739,7 +745,7 @@ def run_fuzzer(args):
def reproduce(args):
"""Reproduce a specific test case from a specific project."""
return reproduce_impl(args.project_name, args.fuzzer_name, args.valgrind, args.env_to_add,
- fuzzer_args, args.testcase_path)
+ args.fuzzer_args, args.testcase_path)
def reproduce_impl(project_name, fuzzer_name, valgrind, env_to_add, fuzzer_args, testcase_path):