devicetree: Fix Device tree tests cannot be built with coverage enabled #83673
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reopen #77208
To Peproduce:
./scripts/twister -p native_sim -T tests/lib/devicetree --coverage-tool gcovr -i --coverage
Logs:
INFO - Using Ninja..
INFO - Zephyr version: v3.7.0-1236-gad3e941ad3ed
INFO - Using 'zephyr' toolchain.
INFO - Building initial testsuite list...
INFO - Writing JSON report xxx/zephyr/twister-out/testplan.json
INFO - JOBS: 22
INFO - Adding tasks to the queue...
INFO - Added initial list of jobs to queue
ERROR - native_sim tests/lib/devicetree/api/libraries.devicetree.api ERROR : Build failure
INFO - xxx/zephyr/twister-out/native_sim/tests/lib/devicetree/api/libraries.devicetree.api/build.log
ERROR - Loading Zephyr default modules (Zephyr base).
/usr/bin/ld: xxx/zephyr/tests/lib/devicetree/api/src/main.c:1190: undefined reference to __device_dts_ord_86'
/usr/bin/ld: xxx/zephyr/tests/lib/devicetree/api/src/main.c:1197: undefined reference to `__device_dts_ord_87'
collect2: error: ld returned 1 exit status
Reason:
DT_SPEC related macro tests (ADC_DT_SPEC_GET_BY_NAME, MBOX_DT_SPEC_GET)should not appear in "api test" because the configuration does not turn on any devices
Move DP_SPEC-related tests to "api_ext test" and enable the related device in the configuration
fix #77205