mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 20:08:09 +00:00
require {input} in target_env or target_options for generator and coverage tasks (#1106)
Fixes #925
This commit is contained in:
@ -124,6 +124,19 @@ def check_target_exe(config: TaskConfig, definition: TaskDefinition) -> None:
|
|||||||
LOGGER.warning(err)
|
LOGGER.warning(err)
|
||||||
|
|
||||||
|
|
||||||
|
def target_uses_input(config: TaskConfig) -> bool:
|
||||||
|
if config.task.target_options is not None:
|
||||||
|
for option in config.task.target_options:
|
||||||
|
if "{input}" in option:
|
||||||
|
return True
|
||||||
|
if config.task.target_env is not None:
|
||||||
|
for value in config.task.target_env.values():
|
||||||
|
if "{input}" in value:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_config(config: TaskConfig) -> None:
|
def check_config(config: TaskConfig) -> None:
|
||||||
if config.task.type not in TASK_DEFINITIONS:
|
if config.task.type not in TASK_DEFINITIONS:
|
||||||
raise TaskConfigError("unsupported task type: %s" % config.task.type.name)
|
raise TaskConfigError("unsupported task type: %s" % config.task.type.name)
|
||||||
@ -143,6 +156,12 @@ def check_config(config: TaskConfig) -> None:
|
|||||||
LOGGER.error(err)
|
LOGGER.error(err)
|
||||||
raise TaskConfigError("missing supervisor_exe")
|
raise TaskConfigError("missing supervisor_exe")
|
||||||
|
|
||||||
|
if (
|
||||||
|
TaskFeature.target_must_use_input in definition.features
|
||||||
|
and not target_uses_input(config)
|
||||||
|
):
|
||||||
|
raise TaskConfigError("{input} must be used in target_env or target_options")
|
||||||
|
|
||||||
if config.vm:
|
if config.vm:
|
||||||
err = "specifying task config vm is no longer supported"
|
err = "specifying task config vm is no longer supported"
|
||||||
raise TaskConfigError(err)
|
raise TaskConfigError(err)
|
||||||
|
@ -21,6 +21,7 @@ TASK_DEFINITIONS = {
|
|||||||
TaskFeature.target_options,
|
TaskFeature.target_options,
|
||||||
TaskFeature.target_timeout,
|
TaskFeature.target_timeout,
|
||||||
TaskFeature.coverage_filter,
|
TaskFeature.coverage_filter,
|
||||||
|
TaskFeature.target_must_use_input,
|
||||||
],
|
],
|
||||||
vm=VmDefinition(compare=Compare.Equal, value=1),
|
vm=VmDefinition(compare=Compare.Equal, value=1),
|
||||||
containers=[
|
containers=[
|
||||||
@ -375,6 +376,7 @@ TASK_DEFINITIONS = {
|
|||||||
TaskFeature.check_debugger,
|
TaskFeature.check_debugger,
|
||||||
TaskFeature.check_retry_count,
|
TaskFeature.check_retry_count,
|
||||||
TaskFeature.ensemble_sync_delay,
|
TaskFeature.ensemble_sync_delay,
|
||||||
|
TaskFeature.target_must_use_input,
|
||||||
],
|
],
|
||||||
vm=VmDefinition(compare=Compare.AtLeast, value=1),
|
vm=VmDefinition(compare=Compare.AtLeast, value=1),
|
||||||
containers=[
|
containers=[
|
||||||
|
@ -81,6 +81,7 @@ class TaskFeature(Enum):
|
|||||||
report_list = "report_list"
|
report_list = "report_list"
|
||||||
minimized_stack_depth = "minimized_stack_depth"
|
minimized_stack_depth = "minimized_stack_depth"
|
||||||
coverage_filter = "coverage_filter"
|
coverage_filter = "coverage_filter"
|
||||||
|
target_must_use_input = "target_must_use_input"
|
||||||
|
|
||||||
|
|
||||||
# Permissions for an Azure Blob Storage Container.
|
# Permissions for an Azure Blob Storage Container.
|
||||||
|
Reference in New Issue
Block a user