Skip to content

Commit 5be6aa1

Browse files
JarmouniAjhedberg
authored andcommitted
scripts: pylib: twister: expr_parser: some enhancements
Rename dt_node_prop_enabled filtering expression to dt_nodelabel_prop_enabled as it takes a node label as a 1st argument. Enhance dt_node_has_prop inline doc and param name. Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
1 parent ae5b69c commit 5be6aa1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ common:
1010
tests:
1111
sample.boards.magic_addr:
1212
filter: CONFIG_NXP_FLEXRAM and
13-
dt_node_prop_enabled("flexram", "flexram,has-magic-addr")
13+
dt_nodelabel_prop_enabled("flexram", "flexram,has-magic-addr")
1414
extra_args:
1515
- platform:mimxrt1170_evk/mimxrt1176/cm7:"DTC_OVERLAY_FILE=flexram.overlay"
1616
- platform:mimxrt1160_evk/mimxrt1166/cm7:"DTC_OVERLAY_FILE=flexram.overlay"

scripts/pylib/twister/expr_parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,19 @@ def ast_expr(ast, env, edt):
273273
if node and node.status == "okay":
274274
return True
275275
return False
276-
elif ast[0] == "dt_node_prop_enabled":
276+
elif ast[0] == "dt_nodelabel_prop_enabled":
277277
label = ast[1][0]
278278
node = edt.label2node.get(label)
279279
prop = ast[1][1]
280280
if node and prop in node.props and node.props[prop].val:
281281
return True
282282
return False
283283
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]
284+
# 1st arg 'node_id' must be a valid node alias (defined in aliases node)
285+
# or a node path
286+
node_id = ast[1][0]
286287
try:
287-
node = edt.get_node(label)
288+
node = edt.get_node(node_id)
288289
except Exception:
289290
return False
290291
prop = ast[1][1]

0 commit comments

Comments
 (0)