twister: use edt.label2node in dt_compat_enabled_with_label DT filter
Use edt.label2node in dt_compat_enabled_with_label DT filter.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Co-authored-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
diff --git a/scripts/pylib/twister/expr_parser.py b/scripts/pylib/twister/expr_parser.py
index 84dc294..5f7813f 100644
--- a/scripts/pylib/twister/expr_parser.py
+++ b/scripts/pylib/twister/expr_parser.py
@@ -267,10 +267,8 @@
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
+ node = edt.label2node.get(label)
+ return node is not None and node.status == 'okay' and node.matching_compat == compat
elif ast[0] == "dt_chosen_enabled":
chosen = ast[1][0]
node = edt.chosen_node(chosen)