Open tejlmand opened 1 year ago
Hi @tejlmand,
This issue, marked as an Enhancement, was opened a while ago and did not get any traction. Please confirm the issue is correctly assigned and re-assign it otherwise.
Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.
Thanks!
Is your enhancement proposal related to a problem? Please describe. The #52894 PR cleaned up the Bluetooth controller unit test significantly by introducing
uut
andmocks
library.However, it still has sub-optimal code like this: https://github.com/zephyrproject-rtos/zephyr/blob/802eabf43f01b72aef615d48b0f08c05a0f32392/tests/bluetooth/controller/ctrl_feature_exchange/CMakeLists.txt#L11-L12 https://github.com/zephyrproject-rtos/zephyr/blob/802eabf43f01b72aef615d48b0f08c05a0f32392/tests/bluetooth/controller/uut/CMakeLists.txt#L38
See also: https://github.com/zephyrproject-rtos/zephyr/pull/52894#discussion_r1067902057
Preferable CMake code which creates libraries should be included in the most straight forward way possible, following the folder structure of the repo.
As mocks may be reusable between test suites, then it should be considered how such sharing can be obtained, and the need for
add_subdirectory()
from the toplevel CMakeLists.txt test file is not needed.Describe the solution you'd like Idea: create common location where CMakeLists.txt are sourced in an heriachy and shared CMake libraries can be created. Two options:
COMPONENTS unittest
, so that the extra CMake tree is sourced based on knowledge provided by top-level CMakeLists file, for example a call like:This approach allows to only source required components. It requires more knowledge by the user writing the test, but no build time penalty.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context