Skip to content

Commit bff47d4

Browse files
committed
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/equeue requires MBED_EXTENDED_TESTS. events/queue and events/timing both require DEVICE_USTICKER.
1 parent e588f80 commit bff47d4

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

events/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
55
if(BUILD_GREENTEA_TESTS)
6-
# add greentea test
6+
add_subdirectory(tests/TESTS)
77
else()
88
add_subdirectory(tests/UNITTESTS)
99
endif()

events/tests/TESTS/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(events/equeue)
5+
add_subdirectory(events/queue)
6+
add_subdirectory(events/timing)
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Copyright (c) 2020 ARM Limited. All rights reserved.
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
4+
include(mbed_greentea)
55

6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-events-equeue)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
6+
if(NOT "MBED_EXTENDED_TESTS" IN_LIST MBED_CONFIG_DEFINITIONS)
7+
set(TEST_SKIPPED "Disabled by default to limit testing time")
8+
endif()
129

1310
mbed_greentea_add_test(
1411
TEST_NAME
15-
${TEST_TARGET}
12+
mbed-events-equeue
1613
TEST_SOURCES
1714
main.cpp
1815
TEST_REQUIRED_LIBS
1916
mbed-events
17+
TEST_SKIPPED
18+
${TEST_SKIPPED}
2019
)
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Copyright (c) 2020 ARM Limited. All rights reserved.
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
4+
include(mbed_greentea)
55

6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-events-queue)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
6+
if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
7+
set(TEST_SKIPPED "Microsecond ticker required")
8+
endif()
129

1310
mbed_greentea_add_test(
1411
TEST_NAME
15-
${TEST_TARGET}
12+
mbed-events-queue
1613
TEST_SOURCES
1714
main.cpp
1815
TEST_REQUIRED_LIBS
1916
mbed-events
17+
TEST_SKIPPED
18+
${TEST_SKIPPED}
2019
)
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Copyright (c) 2020 ARM Limited. All rights reserved.
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
4+
include(mbed_greentea)
55

6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-events-timing)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
6+
if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
7+
set(TEST_SKIPPED "Microsecond ticker required")
8+
endif()
129

1310
mbed_greentea_add_test(
1411
TEST_NAME
15-
${TEST_TARGET}
12+
mbed-events-timing
1613
TEST_SOURCES
1714
main.cpp
1815
TEST_REQUIRED_LIBS
1916
mbed-events
17+
TEST_SKIPPED
18+
${TEST_SKIPPED}
2019
)

0 commit comments

Comments
 (0)