diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-01-21 17:53:09 -0500 |
---|---|---|
committer | Mike Aizatsky <mike.aizatsky@gmail.com> | 2017-01-21 14:53:09 -0800 |
commit | f858d8c7db14a590f54a5e614e5a4803cd4120f8 (patch) | |
tree | d4eed2a6d30224626176f87cc73f2339ee6f4701 | |
parent | 89ae65d5162cde7f2d11843ebdbfca9af005fbe2 (diff) |
Allow run_fuzzer command to run with nonlocal docker. (#306)
By setting the DOCKER_HOST environment variable, all docker invocations will be non-local. This allows run_fuzzer to work in such an environment (as will be the case for many OS X and Windows users).
-rwxr-xr-x | infra/helper.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/infra/helper.py b/infra/helper.py index 02af61dc..88996e41 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -91,8 +91,15 @@ def _check_project_exists(project_name): def _check_fuzzer_exists(project_name, fuzzer_name): """Checks if a fuzzer exists.""" - if not os.path.exists(os.path.join(BUILD_DIR, 'out', project_name, - fuzzer_name)): + command = ['docker', 'run', '--rm'] + command.extend(['-v', '%s:/out' % os.path.join(BUILD_DIR, 'out', project_name)]) + command.append('ubuntu:16.04') + + command.extend(['/bin/bash', '-c', 'test -f /out/%s' % fuzzer_name]) + + try: + subprocess.check_call(command) + except subprocess.CalledProcessError: print(fuzzer_name, 'does not seem to exist. Please run build_fuzzers first.', file=sys.stderr) |