Skip to content

Commit

Permalink
[matter_yamltest] Add a runIf keyword to enable/disable a step based …
Browse files Browse the repository at this point in the history
…on a boolean variable
  • Loading branch information
vivien-apple committed May 15, 2023
1 parent 7c41f50 commit 1ff4d6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/py_matter_yamltests/matter_yamltests/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def __init__(self, test: dict, config: dict, definitions: SpecDefinitions, pics_
self.busy_wait_ms = _value_or_none(test, 'busyWaitMs')
self.wait_for = _value_or_none(test, 'wait')
self.event_number = _value_or_none(test, 'eventNumber')
self.run_if = _value_or_none(test, 'runIf')

self.is_attribute = self.__is_attribute_command()
self.is_event = self.__is_event_command()
Expand Down Expand Up @@ -477,6 +478,8 @@ def __init__(self, test: _TestStepWithPlaceholders, step_index: int, runtime_con
self._update_placeholder_values(self.responses)
self._test.node_id = self._config_variable_substitution(
self._test.node_id)
self._test.run_if = self._config_variable_substitution(
self._test.run_if)
self._test.event_number = self._config_variable_substitution(
self._test.event_number)
test.update_arguments(self.arguments)
Expand All @@ -492,7 +495,7 @@ def is_enabled(self):

@property
def is_pics_enabled(self):
return self._test.is_pics_enabled
return self._test.is_pics_enabled and (self._test.run_if is None or self._test.run_if)

@property
def is_attribute(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __check_test_step(self, content):
'label': str,
'identity': str,
'nodeId': int,
'runIf': str, # Should be a variable.
'groupId': int,
'endpoint': int,
'cluster': str,
Expand Down

0 comments on commit 1ff4d6f

Please sign in to comment.