Skip to content

Commit bd92fcf

Browse files
nashifstephanosio
authored andcommitted
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 213beb5 commit bd92fcf

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
@@ -1201,5 +1201,7 @@ def get_toolchain(self):
12011201
except Exception as e:
12021202
print(str(e))
12031203
sys.exit(2)
1204-
self.toolchain = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1205-
logger.info(f"Using '{self.toolchain}' toolchain.")
1204+
_variant = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1205+
self.compiler = json.loads(result['stdout'])['TOOLCHAIN_VARIANT_COMPILER']
1206+
self.toolchain = f"{_variant}/{self.compiler}"
1207+
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
@@ -873,11 +873,7 @@ def apply_filters(self, **kwargs):
873873
if itoolchain:
874874
toolchain = itoolchain
875875
elif plat.arch in ['posix', 'unit']:
876-
# workaround until toolchain variant in zephyr is overhauled and improved.
877-
if self.env.toolchain in ['llvm']:
878-
toolchain = 'llvm'
879-
else:
880-
toolchain = 'host'
876+
toolchain = 'host/gnu' if not self.env.toolchain else self.env.toolchain
881877
else:
882878
toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
883879

@@ -991,7 +987,9 @@ def apply_filters(self, **kwargs):
991987
instance.add_filter("Native platform requires Linux", Filters.ENVIRONMENT)
992988

993989
if not force_toolchain \
994-
and toolchain and (toolchain not in plat.supported_toolchains):
990+
and toolchain and (toolchain not in plat.supported_toolchains) and \
991+
(toolchain.split('/')[0] not in plat.supported_toolchains):
992+
995993
instance.add_filter(
996994
f"Not supported by the toolchain: {toolchain}",
997995
Filters.PLATFORM

0 commit comments

Comments
 (0)