IAR build fixes before 1.1.0/4.1.0/3.6.6: framework support#289
Conversation
The header `test_common.h` contains two kinds of things: * Things to do at the beginning of individual C files. Specifically, defining macros that notify system headers about what we want from them. Keep those in `test_common.h`, which will subsequently be moved out of the include directory. * Things to do at the beginning of every header. In particular, read the library configuration. Move them to a new header `build_info.h`, which is the only one intended to be included from headers. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Include `"test_common.h"` as the first thing in C files, and `<test/build_info.h>` as the first thing in header files. This requires moving `<test/test_common.h>` to its intended location `"test_common.h"`. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes IAR build issues for the library/unit tests by restructuring test build-configuration includes and adding IAR-specific compatibility knobs in the test harness.
Changes:
- Introduce
tests/include/test/build_info.hand switch test headers to include it (instead oftest_common.h) for consistent build configuration and private-access support. - Move C-file-only setup into
tests/src/test_common.hand ensure test.cfiles include it first. - Add IAR-specific defines and warning suppression for successful compilation with IAR.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/src/threading_helpers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/test_memory.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/test_common.h | Add IAR _DLIB_FILE_DESCRIPTOR define; include test/build_info.h for test build config. |
| tests/src/random.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/psa_memory_poisoning_wrappers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/psa_exercise_key.c | Include test_common.h; suppress an IAR-specific diagnostic. |
| tests/src/psa_crypto_stubs.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/psa_crypto_helpers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/pk_helpers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/helpers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/fake_external_rng_for_test.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/bignum_helpers.c | Replace direct private-access define with test_common.h include. |
| tests/src/bignum_codepath_check.c | Include test_common.h first for consistent compiler/test setup. |
| tests/src/asn1_helpers.c | Include test_common.h first for consistent compiler/test setup. |
| tests/include/test/threading_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/random.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/psa_memory_poisoning_wrappers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/psa_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/psa_exercise_key.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/psa_crypto_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/pk_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/memory.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/macros.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/fake_external_rng_for_test.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/constant_flow.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/build_info.h | New header centralizing test header build configuration and private-access enablement. |
| tests/include/test/bignum_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/bignum_codepath_check.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/asn1_helpers.h | Switch to including new build_info.h (test header build config). |
| tests/include/test/arguments.h | Switch to including new build_info.h (test header build config). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
valeriosetti
left a comment
There was a problem hiding this comment.
The only current failure on the CI (DTLS proxy: 3d, gnutls client, fragmentation, nbio=2) looks spurious and changes look good to me, so I approve
|
I've restarted the CI since we want to see it pass. |
bjwtaylor
left a comment
There was a problem hiding this comment.
Looks good as long as we can get the CI to pass.
Fix the build of the library and the unit tests with IAR.
Also fix a problem with the structure of test helper code that I introduced in #279 and which is causing me a problem in a security fix: part of
test_common.hshould have been intests/src, nottests/include/test.PR checklist