Incorporating the review comments

pull/14072/head
Rajkumar Kanagaraj 2020-12-23 02:58:32 -08:00
parent bcbd243b1b
commit 634d3be5f0
2 changed files with 63 additions and 33 deletions

View File

@ -76,3 +76,20 @@ If you're running CMake directly, you may need to pass it in yourself as follows
```
cmake -S <source-dir> -B <build-dir> -DCMAKE_BUILD_TYPE=debug
```
## How to build a greentea test
Install prerequisites suggested in the previous section and follow the below steps to build:
* Generate .mbed_build configuration for DISCO_L475VG_IOT01A target from blinky example and copied into the test_suite directory.
* Change directory into the test suite directory
* run below command to build full profile green tea
```
touch mbed-os.lib;mkdir build;cd build;cmake .. -GNinja;cmake --build .
```
* run below command to build baremetal profile green tea
```
touch mbed-os.lib;mkdir build;cd build;cmake .. -GNinja -DMBED_BAREMETAL_GREENTEA_TEST=ON;cmake --build .
```
Note: This steps will get evolve once mbedtools have a proper way of invoking greentea test using mbedtools command

View File

@ -1,5 +1,5 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0# the macro
# SPDX-License-Identifier: Apache-2.0
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
@ -13,53 +13,66 @@ include(${MBED_PATH}/tools/cmake/app.cmake)
# TEST_REQUIRED_LIBS - Test suite required libraries
#
# calling the macro:
# mbed_greentea_cmake_macro(TEST_NAME mbed-platform-system-reset TEST_INCLUDE_DIRS mbed_store TEST_SOURCES foo.cpp bar.cpp TEST_REQUIRED_LIBS mbed-kvstore mbed-xyz)
# mbed_greentea_cmake_macro(
# TEST_NAME mbed-platform-system-reset
# TEST_INCLUDE_DIRS mbed_store
# TEST_SOURCES foo.cpp bar.cpp
# TEST_REQUIRED_LIBS mbed-kvstore mbed-xyz
# )
macro(mbed_greentea_cmake_macro)
set(options)
set(singleValueArgs TEST_NAME)
set(multipleValueArgs TEST_INCLUDE_DIRS TEST_SOURCES TEST_REQUIRED_LIBS)
cmake_parse_arguments(MBED_GREENTEA "${options}" "${singleValueArgs}"
"${multipleValueArgs}" ${ARGN} )
set(multipleValueArgs
TEST_INCLUDE_DIRS
TEST_SOURCES
TEST_REQUIRED_LIBS
)
cmake_parse_arguments(MBED_GREENTEA
"${options}"
"${singleValueArgs}"
"${multipleValueArgs}"
${ARGN}
)
set(TEST_NAME ${MBED_GREENTEA_TEST_NAME})
set(TEST_NAME ${MBED_GREENTEA_TEST_NAME})
add_subdirectory(${MBED_PATH} build)
add_subdirectory(${MBED_PATH} build)
add_executable(${TEST_NAME})
add_executable(${TEST_NAME})
mbed_configure_app_target(${TEST_NAME})
mbed_configure_app_target(${TEST_NAME})
mbed_set_mbed_target_linker_script(${TEST_NAME})
mbed_set_mbed_target_linker_script(${TEST_NAME})
target_include_directories(${TEST_NAME}
PRIVATE
.
${MBED_GREENTEA_TEST_INCLUDE_DIRS}
)
target_include_directories(${TEST_NAME}
PRIVATE
.
${MBED_GREENTEA_TEST_INCLUDE_DIRS}
)
target_sources(${TEST_NAME}
PRIVATE
main.cpp
${MBED_GREENTEA_TEST_SOURCES}
)
target_sources(${TEST_NAME}
PRIVATE
main.cpp
${MBED_GREENTEA_TEST_SOURCES}
)
if(MBED_BAREMETAL_GREENTEA_TEST)
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-baremetal mbed-greentea)
else()
if(MBED_BAREMETAL_GREENTEA_TEST)
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-baremetal mbed-greentea)
else()
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-os mbed-greentea)
endif()
endif()
target_link_libraries(${TEST_NAME}
PRIVATE
${MBED_GREENTEA_TEST_REQUIRED_LIBS}
)
target_link_libraries(${TEST_NAME}
PRIVATE
${MBED_GREENTEA_TEST_REQUIRED_LIBS}
)
mbed_set_post_build(${TEST_NAME})
mbed_set_post_build(${TEST_NAME})
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
endmacro()