tests: nrf_cloud: codec/cbor: Fix build after REST removal - #28847
Conversation
CI InformationTo view the history of this post, click the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 2065edc32fd6c9e15d3b55a7446806fca0b866d6 more detailssdk-nrf:
Github labels
List of changed files detected by CI (4)Outputs:ToolchainVersion: f0aa129f09 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
The CBOR codec unit-test PR (nrfconnect#27892) and the REST removal PR (nrfconnect#28522) were merged independently and produced a semantic conflict that left net.lib.nrf_cloud.codec.cbor failing to build on main: * The test referenced REST types (nrf_cloud_rest_agnss_request, nrf_cloud_rest_pgps_request, nrf_cloud_rest_agnss_result, NRF_CLOUD_REST_AGNSS_REQ_*, nrf_cloud_rest_fota_execution_decode) that were renamed to their nrf_cloud_coap_* counterparts by the REST removal. * The REST removal made coap_codec.h transitively pull in net/nrf_cloud_coap.h. Its CoAP-disabled fallback redefined enum coap_content_format, conflicting with zephyr/net/coap.h that the test (and the codec source) include directly. * struct nrf_cloud_coap_pgps_request was gated on CONFIG_NRF_CLOUD_COAP in net/nrf_cloud_pgps.h, so building any codec consumer with PGPS but without COAP left the struct undeclared. Fixes applied: * Rename REST types in the test sources to their nrf_cloud_coap_* equivalents. * In nrf_cloud_coap.h, include zephyr/net/coap.h unconditionally so enum coap_content_format always comes from the canonical Zephyr header. Only zephyr/net/coap_client.h stays gated on CONFIG_NRF_CLOUD_COAP since it requires CONFIG_COAP_CLIENT_*. * In nrf_cloud_pgps.h, define struct nrf_cloud_coap_pgps_request unconditionally - it is a pure data carrier and does not require any CoAP machinery. Verified: net.lib.nrf_cloud.codec.cbor and net.lib.nrf_cloud.codec.json both pass on native_sim and qemu_cortex_m3 (266/266 test cases). Signed-off-by: Pascal Hernandez <pascal.hernandez@nordicsemi.no>
There was a problem hiding this comment.
Pull request overview
This PR resolves build failures in the nRF Cloud CBOR codec unit tests caused by the earlier nRF Cloud REST removal, by aligning test types/symbols with the CoAP equivalents and removing a header-level enum conflict.
Changes:
- Update CBOR codec tests to use
nrf_cloud_coap_*request/result types andNRF_CLOUD_COAP_*enums instead of removed REST symbols. - Ensure
include/net/nrf_cloud_coap.halways includes Zephyr’s canonical<zephyr/net/coap.h>to avoidenum coap_content_formatredefinition conflicts when CoAP is disabled. - Make
struct nrf_cloud_coap_pgps_requestavailable unconditionally ininclude/net/nrf_cloud_pgps.hso PGPS-only builds can still construct requests without requiringCONFIG_NRF_CLOUD_COAP.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/subsys/net/lib/nrf_cloud/codec/cbor/src/main.c | Renames REST test references to CoAP equivalents for A-GNSS/P-GPS CBOR codec tests. |
| tests/subsys/net/lib/nrf_cloud/codec/cbor/src/fakes.c | Renames the FOTA decode stub to the CoAP symbol used by the codec implementation. |
| include/net/nrf_cloud_pgps.h | Defines nrf_cloud_coap_pgps_request unconditionally to fix PGPS-without-CoAP build cases. |
| include/net/nrf_cloud_coap.h | Includes <zephyr/net/coap.h> unconditionally to prevent coap_content_format enum conflicts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Please fix the compliance: |
dbd06dc to
2065edc
Compare
|
You can find the documentation preview for this PR here. |
The CBOR codec unit-test PR (#27892) and the REST removal PR (#28522) were merged independently and produced a semantic conflict that left net.lib.nrf_cloud.codec.cbor failing to build on main:
The test referenced REST types (nrf_cloud_rest_agnss_request, nrf_cloud_rest_pgps_request, nrf_cloud_rest_agnss_result, NRF_CLOUD_REST_AGNSS_REQ_, nrf_cloud_rest_fota_execution_decode) that were renamed to their nrf_cloud_coap_ counterparts by the REST removal.
The REST removal made coap_codec.h transitively pull in net/nrf_cloud_coap.h. Its CoAP-disabled fallback redefined enum coap_content_format, conflicting with zephyr/net/coap.h that the test (and the codec source) include directly.
struct nrf_cloud_coap_pgps_request was gated on CONFIG_NRF_CLOUD_COAP in net/nrf_cloud_pgps.h, so building any codec consumer with PGPS but without COAP left the struct undeclared.
Fixes applied:
Verified: net.lib.nrf_cloud.codec.cbor and net.lib.nrf_cloud.codec.json both pass on native_sim and qemu_cortex_m3 (266/266 test cases).