Skip to content

Commit 57a5054

Browse files
jainvikas8Patater
authored andcommitted
fix: Regression supported targets
`build_tfm.py` lists targets which are TF-M supported in Mbed OS, but not all targets are supported to run regression tests from this script. Therefore intersect to display only supported targets. Signed-off-by: Vikas Katariya <[email protected]>
1 parent dc33375 commit 57a5054

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

build_tfm.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,35 @@ def _clone_tfm_repo(commit):
9494

9595
def _get_tfm_secure_targets():
9696
"""
97-
Creates a list of TF-M secure targets.
97+
Creates a list of TF-M secure targets from Mbed OS targets.json.
9898
9999
:return: List of TF-M secure targets.
100100
"""
101101
return [str(t) for t in TARGET_NAMES if Target.get_target(t).is_TFM_target]
102102

103103

104+
def _get_tfm_regression_targets():
105+
"""
106+
Creates a list of TF-M regression tests supported targets
107+
This parses the yaml file for supported target names and compares them
108+
with TF-M targets supported in Mbed OS
109+
110+
:return: List of supported TF-M regression targets.
111+
"""
112+
with open(join(dirname(__file__), "tfm_ns_import.yaml")) as ns_import:
113+
yaml_data = yaml.safe_load(ns_import)
114+
mbed_os_data = yaml_data["mbed-os"]
115+
tfm_regression_data = yaml_data["tf-m-regression"]
116+
117+
regression_targets = list(
118+
set(_get_tfm_secure_targets())
119+
& set(mbed_os_data)
120+
& set(tfm_regression_data)
121+
)
122+
123+
return regression_targets
124+
125+
104126
def _get_target_info(target, toolchain=None):
105127
"""
106128
Creates a TF-M target tuple (target name, TF-M target name, toolchain,
@@ -550,7 +572,7 @@ def _get_parser():
550572
"--mcu",
551573
help="Build for the given MCU",
552574
default=None,
553-
choices=_get_tfm_secure_targets(),
575+
choices=_get_tfm_regression_targets(),
554576
)
555577

556578
hmsg = "Build for the given toolchain (default is tfm_default_toolchain)"
@@ -610,8 +632,8 @@ def _main():
610632

611633
if args.list:
612634
logging.info(
613-
"Supported TF-M targets are: {}".format(
614-
", ".join([t for t in _get_tfm_secure_targets()])
635+
"Supported TF-M regression targets are: {}".format(
636+
", ".join([t for t in _get_tfm_regression_targets()])
615637
)
616638
)
617639
return

0 commit comments

Comments
 (0)