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).
This commit is contained in:
Alex Gaynor 2017-01-21 17:53:09 -05:00 committed by Mike Aizatsky
parent 89ae65d516
commit f858d8c7db
1 changed files with 9 additions and 2 deletions

View File

@ -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)