Skip to content

Commit a1c597c

Browse files
committed
scripts: pylib: twister: expr_parser: add dt_node_has_prop expression
Add dt_node_has_prop expression to use the existence of a node property as a filter in test configuration yaml files. First argument must be a node alias (in aliases node) or a node path, not a nodelabel. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
1 parent 1b97f4b commit a1c597c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scripts/pylib/twister/expr_parser.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ def ast_expr(ast, env, edt):
280280
if node and prop in node.props and node.props[prop].val:
281281
return True
282282
return False
283+
elif ast[0] == "dt_node_has_prop":
284+
# 1st arg 'label' must be a valid node alias or a node path
285+
label = ast[1][0]
286+
try:
287+
node = edt.get_node(label)
288+
except:
289+
return False
290+
prop = ast[1][1]
291+
if node and prop in node.props:
292+
return True
293+
return False
283294

284295

285296
mutex = threading.Lock()

0 commit comments

Comments
 (0)