Initially, every library greentea test has its project() creation in
their CMake. As running greentea using CTest move all greentea test
suite under one global project mbed-os and MBED_CONFIG_PATH set at
the root mbed os CMake under the condition BUILD_GREENTEA_TESTS
check so refactored storage greentea CMake accordingly.
Call add_test in mbed_greentea_add_test and specify mbedhtrun as the
command to run. A MBED_HTRUN_ARGUMENTS variable has been added, which is
a semicolon separated list of arguments to forward to htrun. The user is
required to pass in any arguments mbedhtrun needs to communicate with
the device under test at CMake configuration time.
Temporary checks have been added to mbed_greentea_add_test to keep the
old flow working until we port all of the greentea tests to CTest.
We rely on external applications to set MBED_CONFIG_PATH and include
app.cmake. Mbed OS can't build for a target without those parameters
set. When building greentea tests there is no external application. So,
we define the appropriate settings in our root CMakeLists.txt for
greentea tests.
The 'post build' functions are made visible by adding the mbed-os
subdirectory. This is not ideal as any components in mbed-os wishing to
call the functions must be added after the functions are defined. To
improve modularity move these functions to a separate CMake script.
We include the post build CMake script in app.cmake for now so we don't
break user's projects.
The stdio implementation of the standalone greentea-client wasn't
streaming "KiVi protocol" messages through the serial IO. Separate out
the existing implementation for greentea-client that uses
mbed_retarget.h's `read` and `write` functions so greentea tests
continue to work with the standalone client.
The IO fixture is shared between the "legacy" embedded greentea-client
and the newer standalone client.
Previously the events stub library depended on `mbed-headers`, which
is a collection of all available headers in mbed-os. To make it easier
to separate the library, only depend on the headers we're using.
Move the header-only mbed-headers-events library the unit test stubs
depend on into the events component directory. This makes the events
stubs more self-contained and improves the composition of the library.
- Previous changes moved all rtos stubs headers into mbed-stubs-rtos-headers
lib, but the decision to keep all stubs headers under the respective
component stubs library so moved all stubs rtos headers under
mbed-stubs-rtos and updated it depend component CMake
- Remove unnecessary add_definition call for UNITTEST as any of the stubs library
added from UNITTEST/CMakeLists.txt is not required this macro
Set MBED_TEST_MODE with INTERFACE. Use INTERFACE because mbed-os is an
interface target, and we can only set INTERFACE properties on interface
targets. This helps avoid the following error when building an
application.
CMake Error at mbed-os/CMakeLists.txt:96 (target_compile_definitions):
target_compile_definitions may only set INTERFACE properties on INTERFACE
targets