From 6a2d49fe92cd1a0f01c7db3f7016e605f01aa6e0 Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Mon, 8 Jul 2024 13:39:31 -0700 Subject: [PATCH 1/2] core: enable use of dedicated oss-fuzz folder This is useful during development purposes where it's convenient being able to adjust the OSS-Fuzz projects' folders. Signed-off-by: David Korczynski --- experiment/oss_fuzz_checkout.py | 8 ++++++-- run_all_experiments.py | 6 +++++- run_one_experiment.py | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/experiment/oss_fuzz_checkout.py b/experiment/oss_fuzz_checkout.py index c4991eaba3..32b9a92a8c 100644 --- a/experiment/oss_fuzz_checkout.py +++ b/experiment/oss_fuzz_checkout.py @@ -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. diff --git a/run_all_experiments.py b/run_all_experiments.py index a774ffb9f8..a82b191947 100755 --- a/run_all_experiments.py +++ b/run_all_experiments.py @@ -218,6 +218,10 @@ 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', @@ -307,7 +311,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 = [] diff --git a/run_one_experiment.py b/run_one_experiment.py index b642294b39..0e2025ba8e 100644 --- a/run_one_experiment.py +++ b/run_one_experiment.py @@ -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() From 9f9f539fd8db7129477c073da7e645a38430466e Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Mon, 8 Jul 2024 13:42:21 -0700 Subject: [PATCH 2/2] style Signed-off-by: David Korczynski --- experiment/oss_fuzz_checkout.py | 2 +- run_all_experiments.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/experiment/oss_fuzz_checkout.py b/experiment/oss_fuzz_checkout.py index 32b9a92a8c..da01f7066c 100644 --- a/experiment/oss_fuzz_checkout.py +++ b/experiment/oss_fuzz_checkout.py @@ -81,7 +81,7 @@ def clone_oss_fuzz(oss_fuzz_dir: str = ''): _set_temp_oss_fuzz_repo() else: global OSS_FUZZ_DIR - OSS_FUZZ_DIR=oss_fuzz_dir + OSS_FUZZ_DIR = oss_fuzz_dir if not os.path.exists(OSS_FUZZ_DIR): _clone_oss_fuzz_repo() diff --git a/run_all_experiments.py b/run_all_experiments.py index a82b191947..65fd5290ce 100755 --- a/run_all_experiments.py +++ b/run_all_experiments.py @@ -218,10 +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( + '-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',