From cfaee96e9245dfa9cf85debcb3e2cdef05e8a163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 5 May 2021 10:28:35 +0200 Subject: [PATCH] twister: Add dt_nodelabel_enabled devicetree filter function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/pylib/twister/expr_parser.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/pylib/twister/expr_parser.py b/scripts/pylib/twister/expr_parser.py index 4354b011dcb..5fbf54230c6 100644 --- a/scripts/pylib/twister/expr_parser.py +++ b/scripts/pylib/twister/expr_parser.py @@ -279,6 +279,12 @@ def ast_expr(ast, env, edt): if node and node.status == "okay": return True 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): # Helper shared with the now deprecated