Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/pylib/twister/expr_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ def ast_expr(ast, env, edt):
if node and prop in node.props and node.props[prop].val:
return True
return False
elif ast[0] == "dt_node_has_prop":
# 1st arg 'label' must be a valid node alias or a node path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to rename dt_node_prop_enabled into dt_nodelabel_prop_enabled to clarify that its 1st argument is a label. There's only 1 place where it's used (samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml).
It would make your added dt_node_has_prop clearer that its 1st arg is a node path/alias.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up PR where I will document the different expressions as well.

label = ast[1][0]
try:
node = edt.get_node(label)
Comment on lines +284 to +287
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not name this variable path (as the get_node() parameter is named)? label is a bit confusing.

Copy link
Contributor Author

@JarmouniA JarmouniA Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be an alias too, but I agree it's confusing, will recheck in a follow-up PR to document these expressions and address #94585 (comment)

except Exception:
return False
prop = ast[1][1]
if prop in node.props:
return True
return False


mutex = threading.Lock()
Expand Down