Skip to content

Commit cc9011d

Browse files
nashiftpambor
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 30339de commit cc9011d

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
@@ -1198,5 +1198,7 @@ def get_toolchain(self):
11981198
except Exception as e:
11991199
print(str(e))
12001200
sys.exit(2)
1201-
self.toolchain = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1202-
logger.info(f"Using '{self.toolchain}' toolchain.")
1201+
_variant = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
1202+
self.compiler = json.loads(result['stdout'])['TOOLCHAIN_VARIANT_COMPILER']
1203+
self.toolchain = f"{_variant}/{self.compiler}"
1204+
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
@@ -882,11 +882,7 @@ def apply_filters(self, **kwargs):
882882
if itoolchain:
883883
toolchain = itoolchain
884884
elif plat.arch in ['posix', 'unit']:
885-
# workaround until toolchain variant in zephyr is overhauled and improved.
886-
if self.env.toolchain in ['llvm']:
887-
toolchain = 'llvm'
888-
else:
889-
toolchain = 'host'
885+
toolchain = 'host/gnu' if not self.env.toolchain else self.env.toolchain
890886
else:
891887
toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
892888

@@ -1000,7 +996,9 @@ def apply_filters(self, **kwargs):
1000996
instance.add_filter("Native platform requires Linux", Filters.ENVIRONMENT)
1001997

1002998
if not force_toolchain \
1003-
and toolchain and (toolchain not in plat.supported_toolchains):
999+
and toolchain and (toolchain not in plat.supported_toolchains) and \
1000+
(toolchain.split('/')[0] not in plat.supported_toolchains):
1001+
10041002
instance.add_filter(
10051003
f"Not supported by the toolchain: {toolchain}",
10061004
Filters.PLATFORM

0 commit comments

Comments
 (0)