-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
unittest: Fix issue with modules #64401
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.
Thanks for providing a fix, but please include the west
CMake module in addition to the zephyr_module
CMake module.
Loading those two module should give you the desired behavior.
cmake/modules/zephyr_module.cmake
Outdated
# Unittest may use modules too, we need to execute zephyr_module to | ||
# generate ZEPHYR_*_MODULE for existent modules. | ||
if(WEST OR ZEPHYR_MODULES OR UNITTEST) |
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 revert.
Modules can either be provided through west
(if installed) or the CMake variable ZEPHYR_MODULES
.
Simply testing for UNITTEST
doesn't ensure that code below is only executed when west
is installed or ZEPHYR_MODULES
is defined.
Instead you must ensure WEST
and thus Zephyr modules are picked up through west
(if not defined directly).
That is, the following line must be added here instead:
zephyr/cmake/modules/unittest.cmake
Line 4 in 9b851b2
include(west)
# Unittest may use modules too, we need to execute zephyr_module to | |
# generate ZEPHYR_*_MODULE for existent modules. | |
if(WEST OR ZEPHYR_MODULES OR UNITTEST) | |
if(WEST OR ZEPHYR_MODULES) |
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.
Including west
will just be used to define WEST
variable and consequently having this block executed ...
Anyway, I have may missed something else. will change it since the change will become simpler.
cmake/modules/unittest.cmake
Outdated
|
||
set(UNITTEST ON CACHE INTERNAL BOOL) |
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.
set(UNITTEST ON CACHE INTERNAL BOOL) |
Generate ZEPHYR_{MODULE_NAME}_MODULE for existent modules for unittests as well since they may be using Zephyr modules. Fixes: 64348 Signed-off-by: Flavio Ceolin <[email protected]>
…able"" This reverts commit 572491a. Signed-off-by: Flavio Ceolin <[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.
Approving on behalf of @tejlmand
Unit tests may use zephyr modules, so we need to run zephyr_module.py