-
Notifications
You must be signed in to change notification settings - Fork 3k
CMake: Add CMake to platform greentea test #14072
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
Conversation
babdb45
to
5d4f694
Compare
@rajkan01, 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.
Same comments for all files.
The changes seem to be a lot of copy/paste with only one line changing. Why not use a macro instead? This way, if we need to modify, we can do it only once instead of 25 times. something like this: # calling the macro
mbed_config_greentea(TEST_NAME mbed-platform-system-reset EXTRA_SOURCES foo.cpp bar.cpp EXTRA_LIBS mbed-kvstore mbed-xyz)
# the macro
macro(mbed_config_greentea)
set(options)
set(singleValueArgs TEST_NAME)
set(multipleValueArgs EXTRA_SOURCES EXTRA_LIBS)
cmake_parse_arguments(MBED_CONFIG_GREENTEA "${options}" "${singleValueArgs}"
"${multipleValueArgs}" ${ARGN} )
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
set(TEST_NAME ${MBED_CONFIG_GREENTEA_TEST_NAME})
include(${MBED_PATH}/tools/cmake/app.cmake)
add_subdirectory(${MBED_PATH} build)
add_executable(${TEST_NAME})
mbed_configure_app_target(${TEST_NAME})
mbed_set_mbed_target_linker_script(${TEST_NAME})
project(${TEST_NAME})
target_sources(${TEST_NAME}
PRIVATE
main.cpp
${MBED_CONFIG_GREENTEA_EXTRA_SOURCES}
)
if(MBED_BAREMETAL_GREENTEA_TEST)
set(USE_LIB mbed-baremetal)
else()
set(USE_LIB mbed-os)
endif()
target_link_libraries(${TEST_NAME}
PRIVATE
${USE_LIB}
mbed-greentea
${MBED_CONFIG_GREENTEA_EXTRA_LIBS}
)
mbed_set_post_build(${TEST_NAME})
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
endmacro() |
5d4f694
to
8704da8
Compare
8704da8
to
a9eda7c
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.
much better with the macro! 👍
ee50d24
to
f27e924
Compare
7c88447
to
95d3716
Compare
934e346
to
360f693
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.
Two steps required:
- rebase to fix travis failure
- commit requested edits from @hugueskamba
We will fix the macro name in the following PR asap.
I approved but should be as request for changes (travis is red anyway).
Pull request has been modified.
CI started |
3b19991
to
eb9bb7b
Compare
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
@0xc0170 This PR is ready for CI, could you start the CI |
CI restarted |
@hugueskamba happy with the current state? |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
mbed_greentea_cmake_macro
with configurable argumentsTEST_NAME
,TEST_INCLUDE_DIRS
,TEST_SOURCES
,TEST_REQUIRED_LIBS
so that it can be used across all the greentea test suite by passing their includes, sources required libraries.MBED_BAREMETAL_GREENTEA_TEST
which canON/OFF
via CMake command-line argument at the configuration time to select/unselect baremetal greentea testImpact of changes
None.
Migration actions required
Note
Documentation
None.
Pull request type
Test results
Manual testing:
Successfully able to build the test suite with below manual steps
-- Generated .mbed_build config for DISCO target from blinky example and copied into the atomic test directory.
-- Manually created test_spec.json, which is required by mbetgt to flash and initiate the test.
-- Reused host_tests python scripts
-- Manually created
runtests.cmake
where it callsmbedgt
command via execute_process()-- CTest -S runtests.cmake
Reviewers
@hugueskamba @0xc0170