Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: enable use of dedicated oss-fuzz folder #456

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forgot to mention this nit: Swap the if-else block for better readability

  if oss_fuzz_dir:
    global OSS_FUZZ_DIR
    OSS_FUZZ_DIR = oss_fuzz_dir
  else:
    _set_temp_oss_fuzz_repo()


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