From 4dc9d87421e35c64e6c6ad77bf76cd456aeed4ec Mon Sep 17 00:00:00 2001 From: Cheick Keita Date: Fri, 30 Oct 2020 18:20:00 -0700 Subject: [PATCH] make merge conditional --- src/cli/onefuzz/templates/libfuzzer.py | 54 ++++++++++++++------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/cli/onefuzz/templates/libfuzzer.py b/src/cli/onefuzz/templates/libfuzzer.py index 42a85c325f3..489e62b3038 100644 --- a/src/cli/onefuzz/templates/libfuzzer.py +++ b/src/cli/onefuzz/templates/libfuzzer.py @@ -48,6 +48,7 @@ def _create_tasks( crash_report_timeout: Optional[int] = None, debug: Optional[List[TaskDebugFlag]] = None, ensemble_sync_delay: Optional[int] = None, + merge: bool = False, ) -> None: fuzzer_containers = [ @@ -127,30 +128,31 @@ def _create_tasks( debug=debug, ) - merge_containers = [ - (ContainerType.setup, containers[ContainerType.setup]), - (ContainerType.unique_inputs, containers[ContainerType.unique_inputs]), - (ContainerType.inputs, containers[ContainerType.inputs]), - ] - - self.logger.info("creating libfuzzer_merge task") - self.onefuzz.tasks.create( - job.job_id, - TaskType.libfuzzer_merge, - target_exe, - merge_containers, - pool_name=pool_name, - duration=duration, - vm_count=1, - reboot_after_setup=reboot_after_setup, - target_options=target_options, - target_env=target_env, - tags=tags, - prereq_tasks=[fuzzer_task.task_id], - target_timeout=crash_report_timeout, - check_retry_count=check_retry_count, - debug=debug, - ) + if merge: + merge_containers = [ + (ContainerType.setup, containers[ContainerType.setup]), + (ContainerType.unique_inputs, containers[ContainerType.unique_inputs]), + (ContainerType.inputs, containers[ContainerType.inputs]), + ] + + self.logger.info("creating libfuzzer_merge task") + self.onefuzz.tasks.create( + job.job_id, + TaskType.libfuzzer_merge, + target_exe, + merge_containers, + pool_name=pool_name, + duration=duration, + vm_count=1, + reboot_after_setup=reboot_after_setup, + target_options=target_options, + target_env=target_env, + tags=tags, + prereq_tasks=[fuzzer_task.task_id], + target_timeout=crash_report_timeout, + check_retry_count=check_retry_count, + debug=debug, + ) def basic( self, @@ -179,6 +181,7 @@ def basic( notification_config: Optional[NotificationConfig] = None, debug: Optional[List[TaskDebugFlag]] = None, ensemble_sync_delay: Optional[int] = None, + merge: bool = False, ) -> Optional[Job]: """ Basic libfuzzer job @@ -218,7 +221,7 @@ def basic( ContainerType.unique_reports, ContainerType.no_repro, ContainerType.coverage, - ContainerType.unique_inputs + ContainerType.unique_inputs, ) if existing_inputs: @@ -253,6 +256,7 @@ def basic( check_retry_count=check_retry_count, debug=debug, ensemble_sync_delay=ensemble_sync_delay, + merge=merge, ) self.logger.info("done creating tasks")