Skip to content

Commit 4dea34a

Browse files
authored
Merge pull request #14803 from Patater/fetchcontent-greentea
Use standalone greentea-client
2 parents e145ae3 + ef07746 commit 4dea34a

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ list(APPEND CMAKE_MODULE_PATH
1717
"${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"
1818
)
1919

20+
add_subdirectory(extern)
21+
2022
option(BUILD_TESTING "Run unit tests only." OFF)
2123

2224
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
@@ -92,7 +94,7 @@ if(${CMAKE_CROSSCOMPILING})
9294
# Add MBED_TEST_MODE for backward compatibility with Greentea tests written for use with Mbed CLI 1
9395
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
9496
target_compile_definitions(${PROJECT_NAME}
95-
PUBLIC
97+
INTERFACE
9698
MBED_TEST_MODE
9799
)
98100
endif()

extern/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include(FetchContent)
5+
6+
FetchContent_Declare(
7+
greentea-client
8+
GIT_REPOSITORY https://github.com/ARMmbed/greentea-client.git
9+
GIT_TAG 472aad2327fbfde827852fc44775904706847a3a
10+
)
11+
12+
FetchContent_MakeAvailable(greentea-client)

extern/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Mbed OS External Dependencies
2+
3+
This directory contains external dependencies, often fetched with CMake's
4+
FetchContent().

features/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
# List of all features libraries available.
55
add_library(mbed-fpga-ci-test-shield INTERFACE)
66
add_library(mbed-client-cli INTERFACE)
7-
add_library(mbed-greentea INTERFACE)
7+
add_library(mbed-unity INTERFACE)
8+
add_library(mbed-utest INTERFACE)
89

910
add_subdirectory(frameworks/COMPONENT_FPGA_CI_TEST_SHIELD)
1011
add_subdirectory(frameworks/mbed-client-cli)
11-
add_subdirectory(frameworks/greentea-client)
1212
add_subdirectory(frameworks/unity)
1313
add_subdirectory(frameworks/utest)

features/frameworks/greentea-client/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
# greentea-client
1111

12+
*Note*: This copy of greentea-client is used only with Mbed CLI 1. Mbed CLI 2
13+
will use the standalone greentea-client, automatically fetched by CMake [in the
14+
`extern/` directory](../../../extern/README.md).
15+
1216
`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.
1317

1418
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.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
target_include_directories(mbed-greentea
4+
target_include_directories(mbed-unity
55
INTERFACE
66
.
77
unity
88
)
99

10-
target_sources(mbed-greentea
10+
target_sources(mbed-unity
1111
INTERFACE
1212
source/unity.c
1313
)

features/frameworks/utest/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
target_include_directories(mbed-greentea
4+
target_include_directories(mbed-utest
55
INTERFACE
66
.
77
utest
88
)
99

10-
target_sources(mbed-greentea
10+
target_sources(mbed-utest
1111
INTERFACE
1212
mbed-utest-shim.cpp
1313
source/unity_handler.cpp

tools/cmake/mbed_greentea.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ macro(mbed_greentea_add_test)
6161
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-os)
6262
endif()
6363

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

6666
target_link_libraries(${MBED_GREENTEA_TEST_NAME}
6767
PRIVATE

0 commit comments

Comments
 (0)