twister: add dt_compat_enabled_with_label DT filter function
The function returns true if the node with the referenced
node label is compatible and enabled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
diff --git a/scripts/pylib/twister/expr_parser.py b/scripts/pylib/twister/expr_parser.py
index 95a2785..84dc294 100644
--- a/scripts/pylib/twister/expr_parser.py
+++ b/scripts/pylib/twister/expr_parser.py
@@ -264,6 +264,13 @@
return ast_handle_dt_enabled_alias_with_parent_compat(edt, alias,
compat)
+ elif ast[0] == "dt_compat_enabled_with_label":
+ compat = ast[1][0]
+ label = ast[1][1]
+ for node in edt.nodes:
+ if node.status == "okay" and label in node.labels and node.matching_compat == compat:
+ return True
+ return False
elif ast[0] == "dt_chosen_enabled":
chosen = ast[1][0]
node = edt.chosen_node(chosen)