twister: Add dt_nodelabel_enabled devicetree filter function

This function takes a node label (not a label property) and returns
true if a node with such label exists and the node is enabled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2021-05-05 10:28:35 +02:00 committed by Christopher Friedt
commit cfaee96e92

View file

@ -279,6 +279,12 @@ def ast_expr(ast, env, edt):
if node and node.status == "okay": if node and node.status == "okay":
return True return True
return False return False
elif ast[0] == "dt_nodelabel_enabled":
label = ast[1][0]
node = edt.label2node.get(label)
if node and node.status == "okay":
return True
return False
def ast_handle_dt_enabled_alias_with_parent_compat(edt, alias, compat): def ast_handle_dt_enabled_alias_with_parent_compat(edt, alias, compat):
# Helper shared with the now deprecated # Helper shared with the now deprecated