-
Notifications
You must be signed in to change notification settings - Fork 3k
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
CMake: Add CMake to mbed-psa greentea tests #14828
CMake: Add CMake to mbed-psa greentea tests #14828
Conversation
@hazzlim, thank you for your changes. |
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.
@hazzlim Thanks for the PR, it looks pretty good to me! I will try a few tests locally.
...ATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/TESTS/attestation/test/CMakeLists.txt
Outdated
Show resolved
Hide resolved
...AL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/TESTS/compliance_attestation/test_a001/CMakeLists.txt
Outdated
Show resolved
Hide resolved
...ATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/TESTS/crypto_init/test/CMakeLists.txt
Outdated
Show resolved
Hide resolved
341080e
to
49e3182
Compare
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 @hazzlim, it looks almost perfect to me - nice improvement to mbed_greentea_add_test
.
Just one remark on a line of comment.
49e3182
to
53d9e7f
Compare
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.
LGTM
...PERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/TESTS/compliance_attestation/test_a001/main.c
Outdated
Show resolved
Hide resolved
@@ -11,6 +11,11 @@ include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) | |||
project(${TEST_TARGET}) | |||
|
|||
mbed_greentea_add_test( | |||
TEST_NAME ${TEST_TARGET} | |||
TEST_REQUIRED_LIBS mbed-ble mbed-events | |||
TEST_NAME |
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.
The style change - was it done by a tool or just follow CMake docs style?
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.
Was done to follow style pointers from Lingkai for previous commits
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.
Possibly a bit of an over-interpretation - is it best as it was?
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.
This is the kind of indentation we have when calling a macro function with parameters, so it looks good to me. I guess what @0xc0170 means is whether it was done manually or by some tool, and the former is the case.
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.
We should set-up cmake-format
as a pre-commit check and specify the style we want to use. It would be great to run the cmake-format
check as part of the CI. That way we will auto-enforce the style and it will always be consistent. We can add a new issue to add cmake-format
to the CI in a separate PR.
53d9e7f
to
b4fdb5d
Compare
MBED_PATH set to /platform directory incorrectly. Updated to set to /mbed-os directory.
CMakeLists.txt file in /hal/tests/TESTS/mbed_hal_fpga_ci_test_shield directory was non-functional as it used the greentea_add_test macro, which expects a main.cpp in current directory, but no main.cpp exists there. I checked with @rajkan01 who confirmed that this CMake file is serving no purpose and is there erroneously. All tests in subdirectories of this directory have their own CMakeLists.txt that successfully build them.
The mbed_greentea_add_test macro previously set a variable in order to use the un-prefixed TEST_NAME to refer to the argument in the macro body. Whilst pair-programming with LDong, this was identified and determined to be unecessary (maybe it was a failed attempt to fix something, that was never reversed?) and so it has been removed.
Assumption that greentea test file is always named main.cpp is incorrect. Updated mbed_greentea_add_test() macro to make TEST_SOURCES parameter compulsory, which is used to specify greentea test file(s). This allows tests to use C, or have a different name. Therefore also updated all pre-existing greentea test CMake files to explicity add main.cpp to TEST_SOURCES.
The greentea test for mbed-psa attestation can now be built with CMake.
The greentea test for mbed-psa crypto_init can now be built with CMake.
The greentea test for mbed-psa its_ps can now be built with CMake.
The greentea test for PSA entropy_inject can now be built with CMake. Note: requires MBEDTLS_ENTROPY_NV_SEED enabled, so not tested on target.
Move /val and /pal directories into /test_abstraction_layers directory and combine into one CMake target, mbed-psa-tal. Moved into seperate directory in order to have own CMakeLists.txt, rather than adding to /TARGET_MBED_PSA_SRV CMake file.
Greentea test for PSA compliance_attestation can now build with CMake.
PSA compliance_its tests can now be built with CMake.
b4fdb5d
to
f69a375
Compare
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.
LGTM
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
mbed_greentea_add_test
macro to require TEST_SOURCES for all files, removing assumption of main.cppFixes #14680
Impact of changes
None.
Migration actions required
None.
Documentation
None.
Pull request type
Test results
Manual testing for pre-existing greentea tests:
All pre-existing tests built successfully using below commands, or fail as expected due to a [NOT_SUPPORTED] error.
Manual testing for PSA tests:
Successfully able to build the test suite with below manual steps:
mbedtools configure -t <toolchain> -m <target> --mbed-os-path <path-to-mbed-os> --app-config TESTS/configs/experimental.json
(requires this PR)cd cmake_build/<target>/develop/<toolchain>/ && cmake ../../../.. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-os && cmake --build .
mbedhtrun -f <path/to/image> -p <port> -d <mount>
All built successfully with both GCC_ARM and ARMC6, and run successfully on target K66F, except:
#error [NOT_SUPPORTED] PSA entropy injection tests can run only with MBEDTLS_ENTROPY_NV_SEED enabled.
(Build successful if the macro is defined, but test crashes when run on K66F)#error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout.
(Build successful if the macro is defined, and test runs to {{result;success}})Reviewers
@Patater @LDong-Arm