From 41cbb5ee00ecb081ae4c7d9124b500bfdf23945e Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Mon, 16 Dec 2024 10:13:49 +0000 Subject: [PATCH] twister: add dt_node_prop_enabled support using "dt_node_prop_enabled" to filter out supported platforms 1. check node existing. 2. check prop in node. 3. check the prop is True. Signed-off-by: Hake Huang --- .../boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml | 2 +- scripts/pylib/twister/expr_parser.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml b/samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml index 1cac7efe9748e7..e25946d7212599 100644 --- a/samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml +++ b/samples/boards/nxp/mimxrt1170_evk_cm7/magic_addr/sample.yaml @@ -9,5 +9,5 @@ common: - pytest tests: sample.boards.mimxrt1170_evk.magic_addr: - filter: CONFIG_MEMC_NXP_FLEXRAM + filter: CONFIG_MEMC_NXP_FLEXRAM and dt_node_prop_enabled("flexram", "flexram,has-magic-addr") harness: pytest diff --git a/scripts/pylib/twister/expr_parser.py b/scripts/pylib/twister/expr_parser.py index 03bee8dbe66830..4fafd453544ce9 100644 --- a/scripts/pylib/twister/expr_parser.py +++ b/scripts/pylib/twister/expr_parser.py @@ -273,6 +273,14 @@ def ast_expr(ast, env, edt): if node and node.status == "okay": return True return False + elif ast[0] == "dt_node_prop_enabled": + label = ast[1][0] + node = edt.label2node.get(label) + prop = ast[1][1] + if node and prop in node.props and node.props[prop].val: + return True + return False + mutex = threading.Lock()