-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Filter tests based on CMake variables. #12393
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12393 +/- ##
=======================================
Coverage 48.62% 48.62%
=======================================
Files 313 313
Lines 46441 46441
Branches 10712 10712
=======================================
Hits 22584 22584
Misses 19398 19398
Partials 4459 4459 Continue to review full report at Codecov.
|
@@ -3,7 +3,7 @@ sample: | |||
name: big_http_download | |||
tests: | |||
test: | |||
platform_exclude: esp32 | |||
filter: TOOLCHAIN_HAS_NEWLIBB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, 'BB' at end of line.
@@ -3,7 +3,7 @@ sample: | |||
name: big_http_download | |||
tests: | |||
test: | |||
platform_exclude: esp32 | |||
filter: TOOLCHAIN_HAS_NEWLIBB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter: TOOLCHAIN_HAS_NEWLIBB | |
filter: TOOLCHAIN_HAS_NEWLIB |
Why do we need that? |
Evidently, he needs to filter based on what kind of toolchain is used. I believe we can already filter on Kconfig. So another approach would be to introduce a Kconfig.toolchain file. This would also solve some other problems we had where we needed to know in Kconfig, properties of the toolchain. |
see discussion in #9522 |
not quite, needed to filter based on capability of a toolchain. :-) |
Seems like we should have the filter be on CONFIG_NEWLIB_LIBC, and that we need to have some means to convey if CONFIG_NEWLIB_LIBC is supported based on the toolchain. |
how exactly do you want to do that? if you filter on CONFIG_NEWLIB_LIBC, then it is always true because it will be in the application configuration. I am not a big fan of creating a Kconfig layer for toolchains, toolchain configuration should only be cmake (toolchain file in cmake speak). regardless of the newlib issue, I think adding another filter based on cmake can be useful. |
We'll not sure how we intend to define toolchain features, but we can use kconfigfunctions.py as a means to access that info. Mostly I feels for this specific case of NEWLIB, we need some means to pull toolchain features into Kconfig, since you can now enable NEWLIB for a toolchain that doesn't support it. So we have 2 means to say something similar and they may not get used consistently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make the NEWLIB feature exposed to Kconfig as well so that we are consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does everything I want it to. And I tend to agree with @nashif that this is probably best done outside of kconfig as it's not an app or platform configuration thing. Though I could live with kconfig too obviously as that was the shortcut I picked originally.
I guess it depends on how closely tied we think sanitycheck/CI/SDK are. If they're all a unified group then it doesn't matter and kconfig is easier. If we want sanitycheck to run reliably on someone's custom toolchain (e.g. where they didn't bother with newlib even though everything else is compatible), then this makes more sense.
I am not following why you want to do that. This change does not change the code or the Kconfig setup or dependencies, it is isolated to making sure our filtering for sanitycheck is sane and scalable and done on the toolchains that we often tests with the assumption that anyone should come with their own toolchain file and build zephyr without having to deal with Kconfig dependencies. |
I feel like this change now we have 2 different means that convey NEWLIB support from a test perspective. One is does the toolchain support newlib, the other is newlib configured. It seems like we should have lib/libc/Kconfig have something like:
and maybe |
Those are 2 different things, I do not see any duplication here.
I do not see them on the same level. Adding the dependency on kconfig level is a bad idea IMO, where does this end? Will we be checking for the host OS in kconfig next and showing users different configurations based on their environment? IMO the configuration has to be the same regardless of the environment being used or when there are interchangeable components such as the toolchain or the build environment.
the macros are a cool feature indeed, but I would apply some caution in using them for this and many other things, lots of magic and dependencies will be created which will make the configuration system very difficult to maintain and might result in random configuration changes caused by the dynamic nature. Talking about dependencies, you proposed macro will not work, the cache file is created after kconfig file was generated but there might be other issues involved. This change is not intrusive to Zephyr and its configuration system:
|
@galak I am not sure how your proposal would work. Doesn't the filtering (i.e. will this particular test be compiled and run for this arch/toolchain) need to happen before the Kconfig tree is parsed? Otherwise, are we actually running Kconfig separately from the actual build in order to see if a particular Kconfig option resolves correctly? |
@carlescufi : This (filtering based on Kconfig) is already supported. Not sure how it was implemented. I assume they pre-run CMake and then check the .config file. |
About whether Kconfig should be aware of the capabilities of the IMHO it should. This would simplify the configuration system for E.g. don't present the user with the ability to enable NEWLIB, It would also allow us to detect whether the enabled toolchain About where the scope of Kconfig ends. It ends when an option The toolchain is not interchange-able (although I wish it was). About how to have Kconfig be aware of the capabilities of a But AFAICT declaring toolchain capabilities could be supported That being said, I agree with @nashif that filtering based on |
and that is why it should not. If I have an application that depends on a feature that is provided by the toolchain, it should not automagically disappear if I used some other or incompatible toolchain. Toolchains should not feed into the the configuration system, an application building with options that are incompatible with the toolchain should just not build. |
It won't automatically disappear. It would be present in prj.conf, and would trigger the warning:
When Kconfig has matured[0], it will even produce an error. Both schemes can cause the build to fail, but only one can prevent users from creating invalid configurations in the first place. And the Kconfig scheme fails earlier, which is generally desirable. |
We have a fundamental disagreement here. I do not think the toolchain should be in Kconfig at all for various reason explained above. Any toolchain also a custom one should be easy to integrate with Zephyr and with only minimal setup, for example by providing a toolchain file or by making it available in the path, adding Kconfig to the mix will just make this complex and impossible for anyone to build with Zephyr if the toolchain is not well integrated. Applications should just fail if they need options that are not provided by the toolchain. period. Having said that, this PR is orthogonal to all of this and does not change anything in Zephyr, it is just a mean for us to have better coverage in testing without complex whitelisting and filtering. If you have a proposal for introducing Kconfig on the toolchain level, you are welcome to send out an RFC and have a thorough discussion with all those involved. If that goes through, it will only build on top of this PR, there is no conflict at all. |
Parse CMakeCache.txt and filter based on variables defined in CMake. The CMakeCache.txt parsing is borrowed from west. Signed-off-by: Anas Nashif <[email protected]>
newlib is not supported with this toolchain, so mark it as such and filter tests based on the variable defined in the toolchain file. Signed-off-by: Anas Nashif <[email protected]>
Do not run with toolchains that do not support newlib. Signed-off-by: Anas Nashif <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will send out an RFC when this re-appears later.
I understand that you want it to be easy for external parties to integrate their toolchains. I hope that if we were to add toolchain information to Kconfig, it would be done in such a way that it would not increase the amount of configuration required for the external party.
My primary concern is not the advanced user that is integrating a new toolchain, but the common user that is using a pre-integrated toolchain.
BTW, in case you missed it, the toolchain variant used is now known to Kconfig and Kconfig is acting differently based on the toolchain (please don't shoot the messenger though, I didn't review this).
Reference issue / enhancement #13162 |
This PR introduces another way to filter tests based on variable available in CMakeCache.txt.
Fixes #12396