Skip to content

Commit ed845e4

Browse files
oss-fuzz: runner: add more direct handling of corpus (#2127)
Signed-off-by: David Korczynski <[email protected]>
1 parent 8bc90e8 commit ed845e4

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

oss_fuzz_integration/runner.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ def get_coverage(project_name, corpus_dir):
387387

388388

389389
def setup_next_corpus_dir(project_name):
390-
fuzzer_names = get_fuzzers(project_name)
391390
corpus_dir = get_next_corpus_dir()
392391
if not os.path.isdir(corpus_dir):
393392
os.mkdir(corpus_dir)
@@ -427,6 +426,10 @@ def introspector_run(
427426
collect_coverage: bool,
428427
start_webserver: bool = True
429428
):
429+
430+
if corpus_dir is None:
431+
corpus_dir = setup_next_corpus_dir(project_name)
432+
430433
if collect_coverage:
431434
complete_coverage_check(
432435
project_name,
@@ -438,41 +441,37 @@ def introspector_run(
438441
)
439442
else:
440443
build_project(project_name, source_dir, to_clean=True)
441-
setup_next_corpus_dir(project_name)
442444

443445
curr_dir = os.path.abspath(".")
444446

445447
# Build sanitizers with introspector
446448
build_project(project_name, source_dir, sanitizer="introspector")
447449

448-
# get the latest corpus
449-
latest_corpus_dir = get_recent_corpus_dir()
450-
451450
# copy over inpsoector and coverage reports
452451

453452
# copy over reports:
454453
# - introspector
455454
# - project coverage
456455
# - per-fuzzer coverage
457-
if os.path.isdir(os.path.join(latest_corpus_dir, "inspector-report")):
458-
shutil.rmtree(os.path.join(latest_corpus_dir, "inspector-report"))
456+
if os.path.isdir(os.path.join(corpus_dir, "inspector-report")):
457+
shutil.rmtree(os.path.join(corpus_dir, "inspector-report"))
459458

460459
shutil.copytree(
461460
os.path.join(curr_dir, "build", "out", project_name, "inspector"),
462-
os.path.join(latest_corpus_dir, "inspector-report")
461+
os.path.join(corpus_dir, "inspector-report")
463462
)
464463
if collect_coverage:
465464
shutil.copytree(
466-
os.path.join(latest_corpus_dir, "report"),
467-
os.path.join(latest_corpus_dir, "inspector-report", "covreport")
465+
os.path.join(corpus_dir, "report"),
466+
os.path.join(corpus_dir, "inspector-report", "covreport")
468467
)
469468

470-
for target_coverage_dir in os.listdir(os.path.join(latest_corpus_dir, "report_target")):
469+
for target_coverage_dir in os.listdir(os.path.join(corpus_dir, "report_target")):
471470
shutil.copytree(
472-
os.path.join(latest_corpus_dir, "report_target", target_coverage_dir),
473-
os.path.join(latest_corpus_dir, "inspector-report", "covreport", target_coverage_dir)
471+
os.path.join(corpus_dir, "report_target", target_coverage_dir),
472+
os.path.join(corpus_dir, "inspector-report", "covreport", target_coverage_dir)
474473
)
475-
server_directory = os.path.join(latest_corpus_dir, "inspector-report")
474+
server_directory = os.path.join(corpus_dir, "inspector-report")
476475

477476
# Patch all jacoco source html report for JVM project
478477
if get_project_lang(project_name) == 'jvm':

0 commit comments

Comments
 (0)