-
Notifications
You must be signed in to change notification settings - Fork 2.1k
kconfig: introduce migration test in CI #14626
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
kconfig: introduce migration test in CI #14626
Conversation
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.
A few minor comments and questions so far.
0b88863
to
5a780cd
Compare
Rebased to fix conflicts |
5a780cd
to
4d38b71
Compare
And again |
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.
To me the changes look sane. @kaspar030 @fjmolinas any comments?
41f96ce
to
6a2516d
Compare
The change makes sense to me as well, should it be given a run through murdock? |
Looks like all is green, @cgundogan can @leandrolanzieri squash (and rebase?)? |
sure, please go ahead @leandrolanzieri |
6a2516d
to
443ef00
Compare
Squashed and rebased. @fjmolinas @cgundogan do you think it would make sense to temporary introduce a commit that makes the test fail just to be sure that it works? I was thinking of some pseudomodule that would still compile in both versions but would make the binary check fail. Ideas? |
yes, sounds like a great idea (: |
I just added a dummy pseudomodule in the application. Now the binary hashes should not match, and the application compile test should fail. |
It seems to have triggered the expected error. |
Yup, looks good. I think it's safe now to remove the commit and get this PR merged. |
This models cortexm_common and cortexm_common_periph modules.
Select it from cortexm_common module as it is always needed.
This switch allows to test the module dependency modelling during the Kconfig migration. When set, it will use the symbols prefixed with CONFIG_MOD_ defined by Kconfig as the list of modules to compile.
This holds a list of .config files to be merged. For more details see kconfig.mk.
The configuration file is included by samd21 so it is merged when using Kconfig.
This adds a list of board/application pairs which should be tested. The test consists on comparing the binaries generated using dependency resolution in Makefile and in Kconfig.
0a810c5
to
8f1fd3a
Compare
Commit removed |
Murdock repeatedly built this PR with success. Here we goooo. |
@@ -8,3 +8,10 @@ config BOARD | |||
string | |||
help | |||
Name of the currently selected board. | |||
|
|||
config MOD_BOARD |
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.
In a previous PR, I already commented that the config for modules should be prefixed with a more explicit name MODULE
instead of MOD
. Too bad this was merged without taking it into account.
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.
Oh sorry, I thought that as there was no response to my reply on the original comment this was OK. I think it's good to have the MODULE
prefix but I did not want to mix them up just now, as those currently come from the USEMODULE
list. Once migration is done we will get rid of the generated module list (Kconfig.dep
) and then we can rename the MOD
symbols.
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.
there was no response to my reply on the original comment this was OK
Just forgot about that sorry. If unsure better ask for a confirmation before.
I think it's good to have the MODULE prefix but I did not want to mix them up just now, as those currently come from the USEMODULE list
This I don't get. Why not do things right from the start and use the MODULE prefix ?
Once migration is done we will get rid of the generated module list (Kconfig.dep) and then we can rename the MOD symbols.
I don't buy this strategy. There are too many modules and I fear that it might become harder to change once the migration is complete. I would prefer to change that as early as possible and before it's too late.
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 I don't get. Why not do things right from the start and use the MODULE prefix ?
If symbols are renamed on what has been migrated so far, one gets the following warning:
warning: default on the choice symbol MODULE_STDIO_UART (defined at bin/samr21-xpro/generated/Kconfig.dep:76, RIOT/sys/Kconfig.stdio:23) will have no effect, as defaults do not affect choice symbols
This is because Kconfig.dep
sets the default of MODULE_STDIO_UART
to y
but in the module modelling this symbol is inside a choice.
We could do it the other way around, changing the prefix for the automatic generated symbols in Kconfig.dep
to MOD_
and use MODULE_
for the proper ones? This would entail doing some renaming on the Kconfigs so far (changing the prefix on the dependencies of the menuconfig
s), but the actual module symbols would need no renaming afterwards.
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 could do it the other way around, changing the prefix for the automatic generated symbols in Kconfig.dep to MOD_ and use MODULE_ for the proper ones?
Is it possible to prefix with _
? for the internally generated symbols. Something like _MODULE_<module>
?
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.
I disagree about the need to accelerate now because I think we are going into the wrong naming direction. If we improve this as early as possible, there will be less renaming work after.
So a good naming consensus should be taken before moving forward. The term MOD_
is very misleading for me since it could mean a modified thing. In the case of a board, this is even more worse.
It's also unclear to me how the internal of these symbols for module work at the moment. It would be great if that could be explained somewhere (maybe it's already the case, I haven't check, and I'll be happy if someone could give me some links).
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.
It's also unclear to me how the internal of these symbols for module work at the moment. It would be great if that could be explained somewhere
If you mean the current automatically generated symbols:
- Documentation on the steps in the integration of Kconfig in the build process (step 1): http://doc.riot-os.org/kconfig-in-riot.html#kconfig-steps-build-process
- Appendix A on how these symbols should be used to have optionally configurable modules: http://doc.riot-os.org/kconfig-in-riot.html#kconfig-appendix-a
- Documentation in the Makefile that generates the symbols:
Lines 118 to 127 in 7a3c371
# Build a Kconfig file defining all used modules and packages. This is done by # defining symbols like 'MODULE_<MODULE_NAME>' or PKG_<PACKAGE_NAME> which # default to 'y'. Then, every module and package Kconfig menu will depend on # that symbol being set to show its options. # Do nothing when testing Kconfig module dependency modelling. $(KCONFIG_GENERATED_DEPENDENCIES): FORCE | $(GENERATED_DIR) $(Q)printf "%s " $(USEMODULE_W_PREFIX) $(USEPKG_W_PREFIX) \ | awk 'BEGIN {RS=" "}{ gsub("-", "_", $$0); \ printf "config %s\n\tbool\n\tdefault y\n", toupper($$0)}' \ | $(LAZYSPONGE) $(LAZYSPONGE_FLAGS) $@
If you mean the new symbols used in migration:
- There is an extensive documentation in the PoC that still can't be merged until the migration is finished a93c011#diff-bd4a0704958a0d6c5cd69178d5de8f69 It tries to clarify the usage of symbols for modules and features, and mention good practices.
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.
@aabadie would you agree with the following prefix changes?
Current prefix | New prefix | Symbol description |
---|---|---|
MODULE_ |
USEMODULE_ |
Symbols generated from USEMODULE variable. Needed only during migration. |
KCONFIG_MODULE_ |
KCONFIG_USEMODULE_ |
Symbols used in menuconfig s to allow optional configuration of used modules. Depend on USEMODULE_ symbols. |
PKG_ |
USEPKG_ |
Symbols generated from USEPKG variable. Needed only during migration. |
KCONFIG_PKG_ |
KCONFIG_USEPKG_ |
Symbols used in menuconfig s to allow optional configuration of used packages. Depend onUSEPKG_ symbols. |
MOD_ |
MODULE_ |
Symbols that model modules in Kconfig. |
PKG_ |
PACKAGE_ |
Symbols that model packages in Kconfig. |
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.
would you agree with the following prefix changes?
Yes!
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.
Please see #14904
Contribution description
This PR splits some initial commits from #14055:
The Murdock script is modified to introduce a test that can be used during the current phase of the migration. The test consists on building certain board/app pairs using Kconfig module modelling to get the list of modules to compile. Then, the binary hash is compared against the hash of the application built normally.
Some initial modules have been modelled in Kconfig, just the bare minimum to get
examples/hello-world
to build forsamr21-xpro
(this means that, for instance, I did not include the whole STDIO modelling like in [PoC] Module dependency modelling using Kconfig #14055).The idea is to build our way application by application, which will get easier as we model more modules. This test will try to ensure also some synchronization with the current makefile-based dependency resolution system.
The proposed way to do the migration, in order to not interfere with the existing Kconfig files, is to model modules using the
MOD_
prefix, and guard all new symbols with theTEST_KCONFIG
symbol (which is set when the environmental variableTEST_KCONFIG
is set). Also, so we don't raise issues with the currentkconfig_features
test, new features (that only exist in Kconfig) have theHAVE_
prefix for now, which can be changed in the future.The
TEST_KCONFIG
variable will serve test purposes during migration, it switches from the makefile-based dependency resolution and Kconfig.Question: Some modules like
sys
andboard
have been modelled as non-visible, should they have a prompt to be configurable?Testing procedure
KCONFIG_ADD_CONFIG
variable) prior to Kconfig runningexamples/hello-world
forsamr21-xpro:gnu
, you should see the output of this test)/bin/sh -c ". ./.murdock; JOBS=4 compile examples/hello-world samr21-xpro:gnu"
Issues/PRs references
Part of #14055