Skip to content

Commit 91bbb04

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 cc7d174 commit 91bbb04

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
@@ -826,11 +826,7 @@ def apply_filters(self, **kwargs):
826826
if itoolchain:
827827
toolchain = itoolchain
828828
elif plat.arch in ['posix', 'unit']:
829-
# workaround until toolchain variant in zephyr is overhauled and improved.
830-
if self.env.toolchain in ['llvm']:
831-
toolchain = 'llvm'
832-
else:
833-
toolchain = 'host'
829+
toolchain = 'host/gnu' if not self.env.toolchain else self.env.toolchain
834830
else:
835831
toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
836832

@@ -944,7 +940,9 @@ def apply_filters(self, **kwargs):
944940
instance.add_filter("Native platform requires Linux", Filters.ENVIRONMENT)
945941

946942
if not force_toolchain \
947-
and toolchain and (toolchain not in plat.supported_toolchains):
943+
and toolchain and (toolchain not in plat.supported_toolchains) and \
944+
(toolchain.split('/')[0] not in plat.supported_toolchains):
945+
948946
instance.add_filter(
949947
f"Not supported by the toolchain: {toolchain}",
950948
Filters.PLATFORM

0 commit comments

Comments
 (0)