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: add integration_toolchains support #82515

Merged

Conversation

nashif
Copy link
Member

@nashif nashif commented Dec 3, 2024

Added integration_toolchains to allow building/testing with multiple
toolchains available in the environment.

This changes the output structure and adds another level in the path
under twister_out signifying the toolchain used. The toolchain used
(variant) is also part of the json output now.

@nashif
Copy link
Member Author

nashif commented Dec 3, 2024

./scripts/twister -p native_sim -s  tests/kernel/common/kernel.common.toolchain -v
Renaming output directory to /home/nashif/zephyrproject/zephyr/twister-out.4
INFO    - Using Ninja..
INFO    - Zephyr version: v4.0.0-1436-gd9f057ded860
INFO    - Using 'zephyr' toolchain.
INFO    - Building initial testsuite list...
INFO    - Writing JSON report /home/nashif/zephyrproject/zephyr/twister-out/testplan.json
INFO    - JOBS: 8
INFO    - Adding tasks to the queue...
INFO    - Added initial list of jobs to queue
INFO    - 1/2 native_sim/native         tests/kernel/common/kernel.common.toolchain        PASSED (native 0.042s (host))
INFO    - 2/2 native_sim/native         tests/kernel/common/kernel.common.toolchain        PASSED (native 0.045s (llvm))```

@nashif nashif force-pushed the topic/twister/integration_toolhcains branch 4 times, most recently from f5723a1 to c721948 Compare December 6, 2024 20:09
@nashif nashif marked this pull request as ready for review December 6, 2024 20:10
@nashif nashif assigned nashif and unassigned andyross and peter-mitsis Dec 6, 2024
@nashif nashif force-pushed the topic/twister/integration_toolhcains branch 3 times, most recently from 5f6e67c to 55730a9 Compare December 9, 2024 18:39
@nashif nashif force-pushed the topic/twister/integration_toolhcains branch 2 times, most recently from 9e91b51 to 182a7c8 Compare December 11, 2024 12:42
@nashif
Copy link
Member Author

nashif commented Dec 11, 2024

with the sample diff in the test config and ./scripts/twister -vv -ll DEBUG -j 1 -p qemu_x86 -T tests/kernel/sleep in summary kernel.common.timing is counted as filtered test suites (static) and the corresponding log is

DEBUG   - qemu_x86/atom             tests/kernel/sleep/kernel.common.timing            SKIPPED: Not supported by the toolchain

this is now addressed

cfriedt
cfriedt previously approved these changes Dec 11, 2024
Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - so is this an alternative to filtering based on toolchain or is it intended to replace filtering based on toolchain? Does it produce fewer skipped / filtered test results?

@nashif
Copy link
Member Author

nashif commented Dec 11, 2024

LGTM - so is this an alternative to filtering based on toolchain or is it intended to replace filtering based on toolchain? Does it produce fewer skipped / filtered test results?

this adds another vector for testing where desired. Right now a test configurations is based on

test scenario -> platforms1 -> toolchain1
test scenario -> platforms2 -> toolchain1

where toolchain1 is whatever is configured in the environment.

with this, it is possible to have:

test scenario -> platforms1 -> toolchain1
test scenario -> platforms1 -> toolchain2
test scenario -> platforms2 -> toolchain1
test scenario -> platforms2 -> toolchain2

@nashif nashif force-pushed the topic/twister/integration_toolhcains branch 5 times, most recently from 934987b to 31f3ff8 Compare December 13, 2024 21:34
hakehuang
hakehuang previously approved these changes Dec 14, 2024
cfriedt
cfriedt previously approved these changes Dec 14, 2024
@nashif nashif dismissed stale reviews from cfriedt and hakehuang via f731d98 December 14, 2024 15:34
@nashif nashif force-pushed the topic/twister/integration_toolhcains branch from 31f3ff8 to f731d98 Compare December 14, 2024 15:34
@zephyrbot zephyrbot added the area: Testsuite Testsuite label Dec 14, 2024
@nashif
Copy link
Member Author

nashif commented Dec 14, 2024

  • added documentation

@@ -355,6 +355,8 @@ def json_report(self, filename, version="NA", platform=None, filters=None):
suite["used_rom"] = used_rom

suite['retries'] = instance.retries
if instance.toolchain:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't instance.toolchain always set to some value ?

if itoolchain:
toolchain = itoolchain
else:
default_toolchain = "zephyr" if not self.env.toolchain else self.env.toolchain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic is worth to mention in doc/develop/test/twister.rst

@golowanow
Copy link
Member

golowanow commented Dec 16, 2024

  1. with this artificial attempt to use the new attribute, for native_sim there are ERROR CMake build failure (native <zephyr>), whereas just SKIPPED: Not supported by the toolchain for qemu_x86.
diff --git a/tests/kernel/sleep/testcase.yaml b/tests/kernel/sleep/testcase.yaml   
index eceb053d082..6472dbae001 100644                                              
--- a/tests/kernel/sleep/testcase.yaml                                             
+++ b/tests/kernel/sleep/testcase.yaml                                             
@@ -1,9 +1,13 @@                                                                   
 tests:                                                                            
   kernel.common.timing:                                                           
+    integration_toolchains:                                                       
+      - host                                                                      
     tags:                                                                         
       - kernel                                                                    
       - sleep                                                                     
   kernel.common.timing.minimallibc:                                               
+    integration_toolchains:                                                       
+      - zephyr                                                                    
     filter: CONFIG_MINIMAL_LIBC_SUPPORTED                                         
     tags:                                                                         
       - kernel                                                                    

with the same probe, I've noticed some confusing log output, e.g. twister -vv -ll DEBUG -T tests/kernel/sleep -p native_sim:

INFO    - Using 'zephyr' toolchain.                                                                                                        
...
DEBUG   - platform filter: ['native_sim']                                                                                                  
...
DEBUG   - Checking platform filter: ['native_sim']                                                                                         
...
DEBUG   - native_sim/native         tests/kernel/sleep/kernel.common.timing.minimallibc FILTERED: Not supported by the toolchain: zephyr 

better to change to something like:

INFO    - Toolchains available: 'host', 'zephyr'.                                                                                                        
...
DEBUG   - native_sim/native         tests/kernel/sleep/kernel.common.timing.minimallibc FILTERED: Not supported for the toolchain: 'host'
or
DEBUG   - native_sim/native         tests/kernel/sleep/kernel.common.timing.minimallibc FILTERED: Needs toolchain(s) 'zephyr' not applicable for the platform. 

nashif added 3 commits January 7, 2025 09:29
Added integration_toolchains to allow building/testing with multiple
toolchains available in the environment.

This changes the output structure and adds another level in the path
under twister_out signifying the toolchain used. The toolchain used
(variant) is also part of the json output now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Use new keyword integration_toolchains to build test using additional
toolchains.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Document the new option and how to use integration_toolchains.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@nashif nashif force-pushed the topic/twister/integration_toolhcains branch from f731d98 to d4f940a Compare January 7, 2025 15:50
@hakehuang hakehuang self-requested a review January 8, 2025 03:56
@kartben kartben merged commit 53486c9 into zephyrproject-rtos:main Jan 8, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants