make: add architecture features and feature blacklisting#9081
make: add architecture features and feature blacklisting#9081kaspar030 merged 3 commits intoRIOT-OS:masterfrom
Conversation
|
(accidently added some leftover test folders, fixing...) |
3bc93d5 to
3e33a4b
Compare
cladmi
left a comment
There was a problem hiding this comment.
As said IRL I really like this.
It extends the functionality to the existing BOARD_BLACKLIST/WHITELIST.
For tests it will be useful to define supported/unsupported things. Even directly in modules/packages, like right now 'micro-ecc' does not work on 16bit.
In the future I would also re-export these FEATURES_USED because having arch_16bit macros available in C code would help configure different behaviors in tests.
But it is another PR.
I just did some naming remarks inline.
| endif | ||
|
|
||
| # turn provided but blacklisted features into required "!<feature>" | ||
| FEATURES_REQUIRED += $(addprefix !,$(sort $(filter $(FEATURES_PROVIDED), $(FEATURES_BLACKLIST)))) |
There was a problem hiding this comment.
I would prefer adding another variable name and/or other if case for this check.
These sections are hard enough to read, so adding an explicit name simplify this.
There was a problem hiding this comment.
You mean, instead of directly adding the blacklisted but available features to FEATURES_REQUIRED, create an intermediate FEATURES_BLACKLISTED and use that in the if below?
I thought about that, but decided to rather go with a nice comment... I think warning: feature "!arch_16bit" missing, expect errors pretty much explains what is happening, and extra variables clutter code.
Do you insist?
makefiles/info-global.inc.mk
Outdated
| include $(RIOTBASE)/Makefile.dep | ||
|
|
||
| FEATURES_MISSING := $$(sort $$(filter-out $$(FEATURES_PROVIDED), $$(FEATURES_REQUIRED))) | ||
| FEATURES_MISSING += $$(addprefix !,$$(sort $$(filter $$(FEATURES_PROVIDED), $$(FEATURES_BLACKLIST)))) |
There was a problem hiding this comment.
Same here I would prefer adding another variable name and/or other if case for this check.
These sections are hard enough to read, so adding an explicit name simplify this.
There was a problem hiding this comment.
this is now gone as it'll be handled in Makefile.features
|
I found the problem why the naming, features re-usage and definition did not fit me. The lack of clarity was hiding the problem. I think it is currently incorrectly using the feature concepts. The From my understanding:
Then the build system only process them if they are in In the current implementation these If it is required to have this information available in the code, like for examples in tests where it would be easier to use a macro than a However, it means only exporting used features, not the available but unused ones. Also, if for any reason, some module needs to blacklist against another feature than IdeasRe-using the concept of FEATURES is I think adapted here, but not as provided ones. |
|
The problem is even more hidden because both feature blacklisting, which should be global to all features, and adding arch features was done in the same pr. |
I don't see a problem. FEATURES_PROVIDED -> "the platform provides a feature" The latter two are used for periph_* in order to select periph_% modules when appropriate. This PR adds: FEATURES_BLACKLIST -> "this feature must not be provided by the platform" In order to re-use fiddly make loops, each feature in FEATURES_BLACKLIST gets added to FEATRUES_REQUIRED with prefixed "!" as "!<feature_name>".
Some features are provided and can lead to code linked in when used, some are "always there". It is a matter of definition. |
|
@cladmi You issue seems to be rooted in the assumption that features should be exported to code. If we consider features a build-system only "feature", there is no issue, right? |
|
My view is that the way it is implemented here, BLACKLISTED works perfectly with But if for any reason, you want to do an app/library that should not work if, for example What I was thinking maybe one of these solutions:
|
|
Huh, why did I close this?
If an app should not work if periph_pm is not included, that turns into it should only work if it is included. Thus periph_pm should be a required feature. If you meant, an app or library should only work if periph_pm is not included (even though it is available as a feature), then this is out of scope for features, and should be handled by the module system. periph_pm is both a module and a feature. If actually used, the feature turns into a used module. |
As said, I personally understand that BLACKLIST should be applied to used features not on available ones, like FEATURES_CONFLICT. As we have different understanding on the semantic, I would like to have other point of view on this. It is an API design, where there are subjective choices, so having other developers feedback could help. |
|
I will also do a documentation PR to summarize what was said here on the existing FEATURES variables. |
aabadie
left a comment
There was a problem hiding this comment.
Just one minor alphabetical order comment. You can squash directly.
fjmolinas
left a comment
There was a problem hiding this comment.
FEATURES_BLACKLIST_GLOBAL should also be part of info-build.
Sorry I think it is actually |
7d8a477 to
78fff6f
Compare
addressed |
78fff6f to
f848999
Compare
aabadie
left a comment
There was a problem hiding this comment.
ACK, please squash.
I've based #12304 on this PR and I confirm the features blacklisting works as expected. @fjmolinas's comment is adressed but let's wait for this approval.
873cba3 to
3eae2f7
Compare
| # features that are used but blacklisted (prepended with "!"). | ||
| # Having features missing may case the build to fail. | ||
| FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED))) | ||
| FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)) \ |
There was a problem hiding this comment.
You are changing the definition of FEATURES_MISSING and not updating the doc:
Line 61 in 3eae2f7
Also why is a used blacklisted feature a FEATURES_MISSING? To me the usage doesn't fit with the name. This would be more of a FEATURES_USED_BLACKLISTED.
There was a problem hiding this comment.
Used but blacklisted features get missed as !<feature>. Doc is here:
There's also _features_used_blacklisted.
There was a problem hiding this comment.
Used but blacklisted features get missed as !<feature>. Doc is here:
https://github.com/kaspar030/RIOT/blob/3eae2f7b792d60f48006d8338c91a73cb4e0a99a/Makefile.features#L25-L29
I referenced RIOT/makefiles/info.inc.mk, not the code.
There's also _features_used_blacklisted.
I'm not arguing this, I'm saying names should make sense with the definiton. A missing FEATURE is not a blacklisted used FEATURE, why does it make sense adding _features_used_blacklisted to FEATURES_MISSING. Is this just to re-use the FEATURES_MISSING error handling?
If I do BOARD=esp8266-olimex-mod make -C tests/lwip info-build, I get:
FEATURES_MISSING (only non optional features):
!arch_esp8266
FEATURES_BLACKLIST (blacklisted features):
arch_esp8266
Before, FEATURES_MISSING was self-documented because the name made sense. Now if I do not look at the code, I do not undersand what is going on with !arch_esp8266, is !arch_esp8266 missing? its not missing? (I do not like double negation). In #11492 an effort was made for names to make sense, edit: to me now it doesn't that much.
There was a problem hiding this comment.
Now if I do not look at the code, I do not undersand what is going on with
!arch_esp8266, is!arch_esp8266missing?
Do you know or do you assume that is what's gonna happen to someone?
I think if this shows up:
FEATURES_MISSING (only non optional features):
!arch_esp8266
FEATURES_BLACKLIST (blacklisted features):
arch_esp8266
it is pretty clear what's happening.
But yes, this is re-using FEATURES_MISSING.
A missing FEATURE is not a blacklisted used FEATURE, why does it make sense adding _features_used_blacklisted to FEATURES_MISSING.
Well, it is adding !feature, not feature, to FEATURES_MISSING. For C devs there should be some meaning there.
Before, features could just be "missing" (e.g., "not provided"). Now, with !feature, they can be "used but blacklisted". A more fitting name might be FEATURE_REQUIREMENTS_UNFULFILLED" or something similar.
Again, we're in a situation where the machinery works but the names are not to everyone's liking.
How about we go with the functionality and move the naming struggle elsewhere?
There was a problem hiding this comment.
Do you know or do you assume that is what's gonna happen to someone?
Yes since I know, to me it doesn't make sense.
How about we go with the functionality and move the naming struggle elsewhere?
...
There was a problem hiding this comment.
How about we go with the functionality and move the naming struggle elsewhere?
I'll dismiss my review.
There are already 2 ACK, so dismissing in favor of consensus.
|
Thanks! |
Contribution description
This PR adds negative feature dependencies (feature blacklisting), allowing a test or module to specify that it will not work if a certain feature is provided.
This is then used to specify architectures or some of their traits as features, and as a next step, use those to blacklist tests.
Previously, if a module or test did not work on e.g., <32bit platforms or with the msp430 toolchain, all boards had to be specified in
BOARD_BLACKLIST, and that list needed to be maintained.With this PR it is possible to blacklist a whole architecture using e.g.,
FEATURES_BLACKLIST += arch_avr8 arch_msp430.edit Also, it is now possible to do e.g.,
FEATURES_REQUIRED += arch_32bit.Issues/PRs references
#8062