Skip to content

Commit

Permalink
CMake: greentea: Port events tests to CTest
Browse files Browse the repository at this point in the history
Following the approach defined in ARMmbed#14892 and ARMmbed#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.
  • Loading branch information
hazzlim committed Aug 12, 2021
1 parent e588f80 commit bff47d4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion events/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions events/tests/TESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 8 additions & 9 deletions events/tests/TESTS/events/equeue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
)
17 changes: 8 additions & 9 deletions events/tests/TESTS/events/queue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
)
17 changes: 8 additions & 9 deletions events/tests/TESTS/events/timing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
)

0 comments on commit bff47d4

Please sign in to comment.