Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twister: Fix toolchain assignment for posix #83762

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keith-zephyr
Copy link
Contributor

twister was unconditionally setting the toolchain to "host" for the "posix" and "unit" architectures, clobbering the toolchain setup in the environment.

@zephyrbot zephyrbot added the area: Twister Twister label Jan 9, 2025
@keith-zephyr keith-zephyr added Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. and removed area: Twister Twister labels Jan 9, 2025
@nashif
Copy link
Member

nashif commented Jan 9, 2025

twister was unconditionally setting the toolchain to "host" for the "posix" and "unit" architectures, clobbering the toolchain setup in the environment.

what environment? you mean you set export ZEPHYR_TOOLCHAIN_VARIANT=llvm and it still uses host?

@keith-zephyr
Copy link
Contributor Author

twister was unconditionally setting the toolchain to "host" for the "posix" and "unit" architectures, clobbering the toolchain setup in the environment.

what environment? you mean you set export ZEPHYR_TOOLCHAIN_VARIANT=llvm and it still uses host?

That's correct. Here's a snippet of a testplan.json file generated:

{                                                                                                                                           
    "environment":{                                                                                                                         
        "os":"posix",
        "zephyr_version":"v2.7.99-52011-g166fb5dd61f5",
        "toolchain":"llvm",
...
    "testsuites":[
        {
            "name":"drivers/drivers.ap_mux_control",
            "arch":"posix",
            "platform":"native_sim/native",
            "path":"../../../platform/ec/zephyr/test/drivers",
            "run_id":"8f1313c1ffcbd3ee543b908d665c37a6",
            "runnable":true,
            "retries":0,
            "toolchain":"host",
...

@thughes
Copy link

thughes commented Jan 9, 2025

Ah, this explains why I was not seeing clang in the build.log when trying to build with LLVM:

ZEPHYR_TOOLCHAIN_VARIANT=llvm VERBOSE=1 ./scripts/twister -c -p native_sim -s cpp.libcxx.host

With this patch, I now see it using clang instead of gcc.

It also looks like this was affecting the Build with Clang/LLVM workflow, which sets ZEPHYR_TOOLCHAIN_VARIANT=llvm. On my recent PR it's showing <host> toolchain when running. The run for this PR correctly shows <llvm>.

@keith-zephyr
Copy link
Contributor Author

Looking at the CI failures, I see that verify-toolchain.cmake falls back to the zephyr toolchain when ZEPHYR_TOOLCHAIN_VARIANT isn't set by the environment. Because of the fallback, self.env.toolchain always has a value.

twister was unconditionally setting the toolchain to "host" for the
"posix" and "unit" architectures, clobbering the toolchain setup in the
environment.

Signed-off-by: Keith Short <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Twister Twister Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants