From eb8658b2bb2251d94695e9464a0eefe19dac5b06 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 approach defined in #14892 and #14902, events greentea tests are ported to enable running with CTest. --- events/CMakeLists.txt | 2 +- events/tests/TESTS/CMakeLists.txt | 6 ++++++ events/tests/TESTS/events/equeue/CMakeLists.txt | 17 ++++++++--------- events/tests/TESTS/events/queue/CMakeLists.txt | 17 ++++++++--------- events/tests/TESTS/events/timing/CMakeLists.txt | 17 ++++++++--------- 5 files changed, 31 insertions(+), 28 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..f15253e1ebc2 100644 --- a/events/tests/TESTS/events/equeue/CMakeLists.txt +++ b/events/tests/TESTS/events/equeue/CMakeLists.txt @@ -1,20 +1,19 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 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-equeue) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "MBED_EXTENDED_TESTS" IN_LIST MBED_CONFIG_DEFINITIONS) + set(TEST_SKIPPED "Disabled by default to limit testing time") +endif() mbed_greentea_add_test( TEST_NAME - ${TEST_TARGET} + mbed-events-equeue TEST_SOURCES main.cpp TEST_REQUIRED_LIBS mbed-events + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/events/tests/TESTS/events/queue/CMakeLists.txt b/events/tests/TESTS/events/queue/CMakeLists.txt index 06183db4b466..198677f402b1 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) 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..9e906603c9b5 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) 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} )