Commit 24207346 authored by Anas Nashif's avatar Anas Nashif Committed by Stephanos Ioannidis
Browse files

twister: support new toolchain variant syntax

support new syntax involving compiler and toolchains with multiple
compilers, i.e. zephyr/gnu

Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent ee0ef953
Loading
Loading
Loading
Loading
+4 −2
Changes for scripts/pylib/twister/twisterlib/environment.py: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1198,5 +1198,7 @@ class TwisterEnv:
        except Exception as e:
            print(str(e))
            sys.exit(2)
        self.toolchain = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
        logger.info(f"Using '{self.toolchain}' toolchain.")
        _variant = json.loads(result['stdout'])['ZEPHYR_TOOLCHAIN_VARIANT']
        self.compiler = json.loads(result['stdout'])['TOOLCHAIN_VARIANT_COMPILER']
        self.toolchain = f"{_variant}/{self.compiler}"
        logger.info(f"Using '{self.toolchain}' toolchain variant.")
+1 −1
Changes for scripts/pylib/twister/twisterlib/testinstance.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class TestInstance:

        if testsuite.detailed_test_id:
            self.build_dir = os.path.join(
                outdir, platform.normalized_name, self.toolchain, testsuite.name
                outdir, platform.normalized_name, self.toolchain.replace('/', '_'), testsuite.name
            )
        else:
            # if suite is not in zephyr,
+4 −6
Changes for scripts/pylib/twister/twisterlib/testplan.py: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -880,11 +880,7 @@ class TestPlan:
                if itoolchain:
                    toolchain = itoolchain
                elif plat.arch in ['posix', 'unit']:
                    # workaround until toolchain variant in zephyr is overhauled and improved.
                    if self.env.toolchain in ['llvm']:
                        toolchain = 'llvm'
                    else:
                        toolchain = 'host'
                        toolchain = 'host/gnu' if not self.env.toolchain else self.env.toolchain
                else:
                    toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain

@@ -998,7 +994,9 @@ class TestPlan:
                    instance.add_filter("Native platform requires Linux", Filters.ENVIRONMENT)

                if not force_toolchain \
                        and toolchain and (toolchain not in plat.supported_toolchains):
                        and toolchain and (toolchain not in plat.supported_toolchains) and \
                                        (toolchain.split('/')[0] not in plat.supported_toolchains):

                    instance.add_filter(
                        f"Not supported by the toolchain: {toolchain}",
                        Filters.PLATFORM