Skip to content

Commit

Permalink
core: enable use of dedicated oss-fuzz folder (#456)
Browse files Browse the repository at this point in the history
This is useful during development purposes where it's convenient being
able to adjust the OSS-Fuzz projects' folders, e.g. to test hypotheses.

---------

Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski authored Jul 8, 2024
1 parent 0bd5057 commit 8261185
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions experiment/oss_fuzz_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ def _clone_oss_fuzz_repo():
print(stderr)


def clone_oss_fuzz(temp_repo: bool = True):
def clone_oss_fuzz(oss_fuzz_dir: str = ''):
"""Clones the OSS-Fuzz repository."""
if temp_repo:
if not oss_fuzz_dir:
_set_temp_oss_fuzz_repo()
else:
global OSS_FUZZ_DIR
OSS_FUZZ_DIR = oss_fuzz_dir

if not os.path.exists(OSS_FUZZ_DIR):
_clone_oss_fuzz_repo()
# Remove existing targets.
Expand Down
8 changes: 7 additions & 1 deletion run_all_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ def parse_args() -> argparse.Namespace:
'--introspector-endpoint',
type=str,
default=introspector.DEFAULT_INTROSPECTOR_ENDPOINT)
parser.add_argument(
'-of',
'--oss-fuzz-dir',
help=
'Path to OSS-Fuzz dir to use. If not set will create temporary directory',
default='')
parser.add_argument(
'-g',
'--generate-benchmarks',
Expand Down Expand Up @@ -307,7 +313,7 @@ def main():
# right API endpoint is used throughout.
introspector.set_introspector_endpoints(args.introspector_endpoint)

run_one_experiment.prepare()
run_one_experiment.prepare(args.oss_fuzz_dir)

experiment_configs = get_experiment_configs(args)
experiment_results = []
Expand Down
4 changes: 2 additions & 2 deletions run_one_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def check_targets(
return None


def prepare() -> None:
def prepare(oss_fuzz_dir: str) -> None:
"""Prepares the experiment environment."""
oss_fuzz_checkout.clone_oss_fuzz(temp_repo=True)
oss_fuzz_checkout.clone_oss_fuzz(oss_fuzz_dir)
oss_fuzz_checkout.postprocess_oss_fuzz()


Expand Down

0 comments on commit 8261185

Please sign in to comment.