Skip to content

Commit 0b2fbb7

Browse files
nashifkeith-packard
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 <anas.nashif@intel.com>
1 parent 6d52c92 commit 0b2fbb7

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

scripts/pylib/twister/twisterlib/environment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,5 +1187,7 @@ def get_toolchain(self):
11871187
except Exception as e:
11881188
print(str(e))
11891189
sys.exit(2)
1190-
self.toolchain = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1191-
logger.info(f"Using '{self.toolchain}' toolchain.")
1190+
_variant = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1191+
self.compiler = json.loads(result['stdout'])['TOOLCHAIN_VARIANT_COMPILER']
1192+
self.toolchain = f"{_variant}/{self.compiler}"
1193+
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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,10 @@ def apply_filters(self, **kwargs):
825825
if itoolchain:
826826
toolchain = itoolchain
827827
elif plat.arch in ['posix', 'unit']:
828-
# workaround until toolchain variant in zephyr is overhauled and improved.
829-
if self.env.toolchain in ['llvm']:
830-
toolchain = 'llvm'
828+
if self.env.toolchain in ['host/llvm']:
829+
toolchain = 'host/llvm'
831830
else:
832-
toolchain = 'host'
831+
toolchain = 'host/gnu'
833832
else:
834833
toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
835834

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

945944
if not force_toolchain \
946-
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+
947948
instance.add_filter(
948949
f"Not supported by the toolchain: {toolchain}",
949950
Filters.PLATFORM

0 commit comments

Comments
 (0)