Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Make change backwards-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Apr 26, 2023
1 parent 7ee93de commit c095669
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions src/cli/onefuzz/templates/libfuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def _create_tasks(
ensemble_sync_delay: Optional[int] = None,
colocate_all_tasks: bool = False,
colocate_secondary_tasks: bool = True,
check_fuzzer_help: bool = False,
no_check_fuzzer_help: bool = False,
expect_crash_on_failure: bool = False,
minimized_stack_depth: Optional[int] = None,
Expand All @@ -75,6 +76,13 @@ def _create_tasks(
analyzer_env: Optional[Dict[str, str]] = None,
tools: Optional[Container] = None,
) -> None:
if check_fuzzer_help:
self.logger.warning(
"--check_fuzzer_help is the default and does not need to be set; this parameter will be removed in a future version"
)
check_fuzzer_help = not no_check_fuzzer_help
del no_check_fuzzer_help

target_options = target_options or []

regression_containers = [
Expand Down Expand Up @@ -113,7 +121,7 @@ def _create_tasks(
tags=tags,
target_timeout=effective_crash_report_timeout,
check_retry_count=check_retry_count,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
debug=debug,
colocate=colocate_all_tasks or colocate_secondary_tasks,
minimized_stack_depth=minimized_stack_depth,
Expand Down Expand Up @@ -169,7 +177,7 @@ def _create_tasks(
debug=debug,
ensemble_sync_delay=ensemble_sync_delay,
colocate=colocate_all_tasks,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
expect_crash_on_failure=expect_crash_on_failure,
)

Expand Down Expand Up @@ -233,7 +241,7 @@ def _create_tasks(
prereq_tasks=prereq_tasks,
debug=debug,
colocate=colocate_all_tasks or colocate_secondary_tasks,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
module_allowlist=module_allowlist,
source_allowlist=source_allowlist,
)
Expand Down Expand Up @@ -267,7 +275,7 @@ def _create_tasks(
prereq_tasks=prereq_tasks,
target_timeout=effective_crash_report_timeout,
check_retry_count=check_retry_count,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
debug=debug,
colocate=colocate_all_tasks or colocate_secondary_tasks,
minimized_stack_depth=minimized_stack_depth,
Expand Down Expand Up @@ -348,6 +356,7 @@ def basic(
ensemble_sync_delay: Optional[int] = None,
colocate_all_tasks: bool = False,
colocate_secondary_tasks: bool = True,
check_fuzzer_help: bool = False,
no_check_fuzzer_help: bool = False,
expect_crash_on_failure: bool = False,
minimized_stack_depth: Optional[int] = None,
Expand All @@ -367,6 +376,13 @@ def basic(
syncing inputs during ensemble fuzzing (0 to disable).
"""

if check_fuzzer_help:
self.logger.warning(
"--check_fuzzer_help is the default and does not need to be set; this parameter will be removed in a future version"
)
check_fuzzer_help = not no_check_fuzzer_help
del no_check_fuzzer_help

# verify containers exist
if existing_inputs:
self.onefuzz.containers.get(existing_inputs)
Expand Down Expand Up @@ -471,7 +487,7 @@ def basic(
ensemble_sync_delay=ensemble_sync_delay,
colocate_all_tasks=colocate_all_tasks,
colocate_secondary_tasks=colocate_secondary_tasks,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
expect_crash_on_failure=expect_crash_on_failure,
minimized_stack_depth=minimized_stack_depth,
module_allowlist=module_allowlist_blob_name,
Expand Down Expand Up @@ -512,12 +528,19 @@ def merge(
notification_config: Optional[NotificationConfig] = None,
debug: Optional[List[TaskDebugFlag]] = None,
preserve_existing_outputs: bool = False,
check_fuzzer_help: bool = False,
no_check_fuzzer_help: bool = False,
extra_container: Optional[Container] = None,
) -> Optional[Job]:
"""
libfuzzer merge task
"""
if check_fuzzer_help:
self.logger.warning(
"--check_fuzzer_help is the default and does not need to be set; this parameter will be removed in a future version"
)
check_fuzzer_help = not no_check_fuzzer_help
del no_check_fuzzer_help

# verify containers exist
if existing_inputs:
Expand Down Expand Up @@ -604,7 +627,7 @@ def merge(
check_retry_count=check_retry_count,
debug=debug,
preserve_existing_outputs=preserve_existing_outputs,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
)

self.logger.info("done creating tasks")
Expand Down Expand Up @@ -870,13 +893,20 @@ def qemu_user(
colocate_all_tasks: bool = False,
crash_report_timeout: Optional[int] = 1,
check_retry_count: Optional[int] = 300,
check_fuzzer_help: bool = False,
no_check_fuzzer_help: bool = False,
extra_container: Optional[Container] = None,
crashes: Optional[Container] = None,
) -> Optional[Job]:
"""
libfuzzer tasks, wrapped via qemu-user (PREVIEW FEATURE)
"""
if check_fuzzer_help:
self.logger.warning(
"--check_fuzzer_help is the default and does not need to be set; this parameter will be removed in a future version"
)
check_fuzzer_help=not no_check_fuzzer_help
del no_check_fuzzer_help

self.logger.warning(
"qemu_user jobs are a preview feature and may change in the future"
Expand Down Expand Up @@ -1017,7 +1047,7 @@ def qemu_user(
debug=debug,
ensemble_sync_delay=ensemble_sync_delay,
expect_crash_on_failure=False,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
)

report_containers = [
Expand Down Expand Up @@ -1053,7 +1083,7 @@ def qemu_user(
debug=debug,
colocate=colocate_all_tasks,
expect_crash_on_failure=False,
check_fuzzer_help=not no_check_fuzzer_help,
check_fuzzer_help=check_fuzzer_help,
)

self.logger.info("done creating tasks")
Expand Down

0 comments on commit c095669

Please sign in to comment.