Support jcc for cloud experiments. (#10738)

This commit is contained in:
Oliver Chang 2023-07-24 12:35:02 +10:00 committed by GitHub
parent f3b06dc8ed
commit bf04c203db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -305,7 +305,11 @@ def get_id(step_type, build):
def get_build_steps( # pylint: disable=too-many-locals, too-many-statements, too-many-branches, too-many-arguments
project_name, project_yaml, dockerfile, config):
project_name,
project_yaml,
dockerfile,
config,
additional_env=None):
"""Returns build steps for project."""
project = Project(project_name, project_yaml, dockerfile)
@ -336,6 +340,9 @@ def get_build_steps( # pylint: disable=too-many-locals, too-many-statements, to
continue
env = get_env(project.fuzzing_language, build)
if additional_env:
env.extend(additional_env)
compile_step = get_compile_step(project, build, env, config.parallel,
config.upload_build_logs)
build_steps.append(compile_step)

View File

@ -25,6 +25,8 @@ import google.auth
import build_lib
import build_project
JCC_DIR = '/usr/local/bin/jcc'
def run_experiment(project_name, target_name, args, output_path,
build_output_path, upload_corpus_path, upload_coverage_path,
@ -58,8 +60,15 @@ def run_experiment(project_name, target_name, args, output_path,
# Don't do bad build checks.
project_yaml['run_tests'] = False
steps = build_project.get_build_steps(project_name, project_yaml,
dockerfile_contents, config)
jcc_env = [
f'CC={JCC_DIR}/clang',
f'CXX={JCC_DIR}/clang++',
]
steps = build_project.get_build_steps(project_name,
project_yaml,
dockerfile_contents,
config,
additional_env=jcc_env)
build = build_project.Build('libfuzzer', 'address', 'x86_64')
local_output_path = '/workspace/output.log'
@ -109,6 +118,7 @@ def run_experiment(project_name, target_name, args, output_path,
# Build for coverage.
build = build_project.Build('libfuzzer', 'coverage', 'x86_64')
env = build_project.get_env(project_yaml['language'], build)
env.extend(jcc_env)
steps.append(
build_project.get_compile_step(project, build, env, config.parallel))