Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ list(APPEND CMAKE_MODULE_PATH
"${mbed-os_SOURCE_DIR}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_Cypress/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_NXP/scripts"
)

add_subdirectory(extern)

option(BUILD_TESTING "Run unit tests only." OFF)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
Expand Down Expand Up @@ -92,7 +94,7 @@ if(${CMAKE_CROSSCOMPILING})
# Add MBED_TEST_MODE for backward compatibility with Greentea tests written for use with Mbed CLI 1
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
target_compile_definitions(${PROJECT_NAME}
PUBLIC
INTERFACE
MBED_TEST_MODE
)
endif()
Expand Down
12 changes: 12 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

include(FetchContent)

FetchContent_Declare(
greentea-client
GIT_REPOSITORY https://github.com/ARMmbed/greentea-client.git
GIT_TAG 472aad2327fbfde827852fc44775904706847a3a
)

FetchContent_MakeAvailable(greentea-client)
4 changes: 4 additions & 0 deletions extern/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Mbed OS External Dependencies

This directory contains external dependencies, often fetched with CMake's
FetchContent().
4 changes: 2 additions & 2 deletions features/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# List of all features libraries available.
add_library(mbed-fpga-ci-test-shield INTERFACE)
add_library(mbed-client-cli INTERFACE)
add_library(mbed-greentea INTERFACE)
add_library(mbed-unity INTERFACE)
add_library(mbed-utest INTERFACE)

add_subdirectory(frameworks/COMPONENT_FPGA_CI_TEST_SHIELD)
add_subdirectory(frameworks/mbed-client-cli)
add_subdirectory(frameworks/greentea-client)
add_subdirectory(frameworks/unity)
add_subdirectory(frameworks/utest)
4 changes: 4 additions & 0 deletions features/frameworks/greentea-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

# greentea-client

*Note*: This copy of greentea-client is used only with Mbed CLI 1. Mbed CLI 2
will use the standalone greentea-client, automatically fetched by CMake [in the
`extern/` directory](../../../extern/README.md).

`greentea-client` is a client library for [the Greentea test tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea) when used in an [Mbed OS](https://os.mbed.com/) project.

This package implements the client side of the key-value protocol used for communication between the device under test (DUT) and the host. The `Greentea` tool implements the protocol's host behavior. We use [utest](https://github.com/ARMmbed/mbed-os/blob/master/features/frameworks/utest/README.md) as our test harness.
Expand Down
4 changes: 2 additions & 2 deletions features/frameworks/unity/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

target_include_directories(mbed-greentea
target_include_directories(mbed-unity
INTERFACE
.
unity
)

target_sources(mbed-greentea
target_sources(mbed-unity
INTERFACE
source/unity.c
)
4 changes: 2 additions & 2 deletions features/frameworks/utest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

target_include_directories(mbed-greentea
target_include_directories(mbed-utest
INTERFACE
.
utest
)

target_sources(mbed-greentea
target_sources(mbed-utest
INTERFACE
mbed-utest-shim.cpp
source/unity_handler.cpp
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/mbed_greentea.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ macro(mbed_greentea_add_test)
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-os)
endif()

list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-greentea)
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS greentea::client mbed-unity mbed-utest)

target_link_libraries(${MBED_GREENTEA_TEST_NAME}
PRIVATE
Expand Down