Skip to content

Commit 98ce459

Browse files
committed
twister: support new toolchain variant syntax
support new syntax involving compiler and toolchains with multiple compilers, i.e. zephyr/gnu Signed-off-by: Anas Nashif <[email protected]>
1 parent bad7273 commit 98ce459

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

scripts/pylib/twister/twisterlib/environment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,5 +1190,7 @@ def get_toolchain(self):
11901190
except Exception as e:
11911191
print(str(e))
11921192
sys.exit(2)
1193-
self.toolchain = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1194-
logger.info(f"Using '{self.toolchain}' toolchain.")
1193+
_variant = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1194+
self.compiler = json.loads(result['stdout'])['TOOLCHAIN_VARIANT_COMPILER']
1195+
self.toolchain = f"{_variant}/{self.compiler}"
1196+
logger.info(f"Using '{self.toolchain}' toolchain variant.")

scripts/pylib/twister/twisterlib/testinstance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self, testsuite, platform, toolchain, outdir):
7474

7575
if testsuite.detailed_test_id:
7676
self.build_dir = os.path.join(
77-
outdir, platform.normalized_name, self.toolchain, testsuite.name
77+
outdir, platform.normalized_name, self.toolchain.replace('/', '_'), testsuite.name
7878
)
7979
else:
8080
# if suite is not in zephyr,

scripts/pylib/twister/twisterlib/testplan.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,11 +828,7 @@ def apply_filters(self, **kwargs):
828828
if itoolchain:
829829
toolchain = itoolchain
830830
elif plat.arch in ['posix', 'unit']:
831-
# workaround until toolchain variant in zephyr is overhauled and improved.
832-
if self.env.toolchain in ['llvm']:
833-
toolchain = 'llvm'
834-
else:
835-
toolchain = 'host'
831+
toolchain = 'host/gnu' if not self.env.toolchain else self.env.toolchain
836832
else:
837833
toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
838834

@@ -946,7 +942,9 @@ def apply_filters(self, **kwargs):
946942
instance.add_filter("Native platform requires Linux", Filters.ENVIRONMENT)
947943

948944
if not force_toolchain \
949-
and toolchain and (toolchain not in plat.supported_toolchains):
945+
and toolchain and (toolchain not in plat.supported_toolchains) and \
946+
(toolchain.split('/')[0] not in plat.supported_toolchains):
947+
950948
instance.add_filter(
951949
f"Not supported by the toolchain: {toolchain}",
952950
Filters.PLATFORM

0 commit comments

Comments
 (0)