From 4daeb86d2adc4fb512a6c18b9ec65b3fdd94032e Mon Sep 17 00:00:00 2001 From: Hari Limaye Date: Wed, 4 Aug 2021 11:15:34 +0100 Subject: [PATCH] CMake: greentea: Port events tests to CTest Following the approach defined in #14892 and #14902, events greentea tests are ported to enable running with CTest. events/queue and events/timing both require DEVICE_USTICKER. --- events/CMakeLists.txt | 2 +- events/tests/TESTS/CMakeLists.txt | 6 ++++++ events/tests/TESTS/events/equeue/CMakeLists.txt | 13 +++---------- events/tests/TESTS/events/queue/CMakeLists.txt | 17 ++++++++--------- events/tests/TESTS/events/timing/CMakeLists.txt | 17 ++++++++--------- 5 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 events/tests/TESTS/CMakeLists.txt diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt index 6e7a6c6bda9d..61a606aecf86 100644 --- a/events/CMakeLists.txt +++ b/events/CMakeLists.txt @@ -3,7 +3,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) if(BUILD_GREENTEA_TESTS) - # add greentea test + add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) endif() diff --git a/events/tests/TESTS/CMakeLists.txt b/events/tests/TESTS/CMakeLists.txt new file mode 100644 index 000000000000..d62badeee32b --- /dev/null +++ b/events/tests/TESTS/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2021 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(events/equeue) +add_subdirectory(events/queue) +add_subdirectory(events/timing) diff --git a/events/tests/TESTS/events/equeue/CMakeLists.txt b/events/tests/TESTS/events/equeue/CMakeLists.txt index f49813e1b285..979651a117b1 100644 --- a/events/tests/TESTS/events/equeue/CMakeLists.txt +++ b/events/tests/TESTS/events/equeue/CMakeLists.txt @@ -1,18 +1,11 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-events-equeue) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +include(mbed_greentea) mbed_greentea_add_test( TEST_NAME - ${TEST_TARGET} + mbed-events-equeue TEST_SOURCES main.cpp TEST_REQUIRED_LIBS diff --git a/events/tests/TESTS/events/queue/CMakeLists.txt b/events/tests/TESTS/events/queue/CMakeLists.txt index 06183db4b466..020dcba106b7 100644 --- a/events/tests/TESTS/events/queue/CMakeLists.txt +++ b/events/tests/TESTS/events/queue/CMakeLists.txt @@ -1,20 +1,19 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) +include(mbed_greentea) -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-events-queue) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Microsecond ticker required") +endif() mbed_greentea_add_test( TEST_NAME - ${TEST_TARGET} + mbed-events-queue TEST_SOURCES main.cpp TEST_REQUIRED_LIBS mbed-events + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/events/tests/TESTS/events/timing/CMakeLists.txt b/events/tests/TESTS/events/timing/CMakeLists.txt index f979ea3c7200..addbd14c0ba2 100644 --- a/events/tests/TESTS/events/timing/CMakeLists.txt +++ b/events/tests/TESTS/events/timing/CMakeLists.txt @@ -1,20 +1,19 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) +include(mbed_greentea) -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-events-timing) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Microsecond ticker required") +endif() mbed_greentea_add_test( TEST_NAME - ${TEST_TARGET} + mbed-events-timing TEST_SOURCES main.cpp TEST_REQUIRED_LIBS mbed-events + TEST_SKIPPED + ${TEST_SKIPPED} )