Skip to content

Commit

Permalink
target_experiment: fixes.
Browse files Browse the repository at this point in the history
- Fix coverage report generation. The wrong corpus was being used.
- Delete the corpus.zip after we upload it.
  • Loading branch information
oliverchang committed Jul 13, 2023
1 parent 7d2cdaf commit 1faacc8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions infra/build/functions/target_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def run_experiment(project_name, target_name, args, output_path,

build = build_project.Build('libfuzzer', 'address', 'x86_64')
local_output_path = '/workspace/output.log'
local_corpus_path = '/workspace/corpus'
local_corpus_path_base = '/workspace/corpus'
local_corpus_path = os.path.join(local_corpus_path_base, target_name)
local_corpus_zip_path = '/workspace/corpus/corpus.zip'
fuzzer_args = ' '.join(args)

Expand All @@ -78,7 +79,7 @@ def run_experiment(project_name, target_name, args, output_path,
'args': [
'bash',
'-c',
(f'mkdir {local_corpus_path} && '
(f'mkdir -p {local_corpus_path} && '
f'run_fuzzer {target_name} {fuzzer_args} '
f'|& tee {local_output_path} || true'),
]
Expand All @@ -100,7 +101,7 @@ def run_experiment(project_name, target_name, args, output_path,
(f'cd {local_corpus_path} && '
f'zip -r {local_corpus_zip_path} * && '
f'gsutil -m cp {local_corpus_zip_path} {upload_corpus_path} || '
f'true'),
f'rm -f {local_corpus_zip_path}'),
],
})

Expand All @@ -113,7 +114,8 @@ def run_experiment(project_name, target_name, args, output_path,

# Generate coverage report.
env.extend([
'CORPUS_DIR=' + local_corpus_path,
# The coverage script automatically adds the target name to this.
'CORPUS_DIR=' + local_corpus_path_base,
'HTTP_PORT=',
f'COVERAGE_EXTRA_ARGS={project.coverage_extra_args.strip()}',
])
Expand Down

0 comments on commit 1faacc8

Please sign in to comment.