scripts: twister: Fix error in dt_label_with_parent_compat_enabled

In dt_label_with_parent_compat_enabled, it maybe that there is
no node matching expected label.
In this case don't generate error, but return False.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2021-06-23 13:43:28 +02:00 committed by Anas Nashif
commit e5bf24b325

View file

@ -268,7 +268,10 @@ def ast_expr(ast, env, edt):
compat = ast[1][1] compat = ast[1][1]
label = ast[1][0] label = ast[1][0]
node = edt.label2node.get(label) node = edt.label2node.get(label)
parent = node.parent if node is not None:
parent = node.parent
else:
return False
return parent is not None and parent.status == 'okay' and parent.matching_compat == compat return parent is not None and parent.status == 'okay' and parent.matching_compat == compat
elif ast[0] == "dt_chosen_enabled": elif ast[0] == "dt_chosen_enabled":
chosen = ast[1][0] chosen = ast[1][0]