mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14902 from LDong-Arm/greentea_skip
CMake: tests: Support skipping unsupported test with reasonpull/14993/head
commit
e588f80d13
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
include(mbed_greentea)
|
include(mbed_greentea)
|
||||||
|
|
||||||
|
if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
|
||||||
|
set(TEST_SKIPPED "Microsecond ticker required")
|
||||||
|
endif()
|
||||||
|
|
||||||
mbed_greentea_add_test(
|
mbed_greentea_add_test(
|
||||||
TEST_NAME
|
TEST_NAME
|
||||||
mbed-drivers-ticker
|
mbed-drivers-ticker
|
||||||
|
@ -10,4 +14,6 @@ mbed_greentea_add_test(
|
||||||
main.cpp
|
main.cpp
|
||||||
HOST_TESTS_DIR
|
HOST_TESTS_DIR
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/../../host_tests"
|
"${CMAKE_CURRENT_LIST_DIR}/../../host_tests"
|
||||||
|
TEST_SKIPPED
|
||||||
|
${TEST_SKIPPED}
|
||||||
)
|
)
|
||||||
|
|
|
@ -73,3 +73,8 @@ target_link_libraries(mbed-psa
|
||||||
|
|
||||||
add_subdirectory(test_abstraction_layers)
|
add_subdirectory(test_abstraction_layers)
|
||||||
|
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
|
||||||
|
if(BUILD_GREENTEA_TESTS)
|
||||||
|
add_subdirectory(TESTS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Copyright (c) 2021 Arm Limited. All rights reserved.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
add_subdirectory(attestation/test)
|
|
@ -1,18 +1,17 @@
|
||||||
# Copyright (c) 2021 ARM Limited. All rights reserved.
|
# Copyright (c) 2021 ARM Limited. All rights reserved.
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# 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 "")
|
if(MBED_GREENTEA_TEST_BAREMETAL)
|
||||||
set(TEST_TARGET mbed-platform-psa-attestation)
|
set(TEST_SKIPPED "RTOS required")
|
||||||
|
endif()
|
||||||
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
|
|
||||||
|
|
||||||
project(${TEST_TARGET})
|
|
||||||
|
|
||||||
mbed_greentea_add_test(
|
mbed_greentea_add_test(
|
||||||
TEST_NAME
|
TEST_NAME
|
||||||
${TEST_TARGET}
|
mbed-platform-psa-attestation
|
||||||
TEST_SOURCES
|
TEST_SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
|
TEST_SKIPPED
|
||||||
|
${TEST_SKIPPED}
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,19 +20,35 @@ endif()
|
||||||
# TEST_SOURCES - Test suite sources
|
# TEST_SOURCES - Test suite sources
|
||||||
# TEST_REQUIRED_LIBS - Test suite required libraries
|
# TEST_REQUIRED_LIBS - Test suite required libraries
|
||||||
# HOST_TESTS_DIR - Path to the "host_tests" directory
|
# HOST_TESTS_DIR - Path to the "host_tests" directory
|
||||||
|
# TEST_SKIPPED - Reason if suite is skipped
|
||||||
#
|
#
|
||||||
# calling the macro:
|
# calling the macro:
|
||||||
|
# if(MBED_GREENTEA_TEST_BAREMETAL)
|
||||||
|
# set(skip_reason "RTOS required")
|
||||||
|
# endif()
|
||||||
# mbed_greentea_add_test(
|
# mbed_greentea_add_test(
|
||||||
# TEST_NAME mbed-platform-system-reset
|
# TEST_NAME
|
||||||
# TEST_INCLUDE_DIRS mbed_store
|
# mbed-platform-system-reset
|
||||||
# TEST_SOURCES foo.cpp bar.cpp
|
# TEST_INCLUDE_DIRS
|
||||||
# TEST_REQUIRED_LIBS mbed-kvstore mbed-xyz
|
# mbed_store
|
||||||
# HOST_TESTS_DIR ${CMAKE_CURRENT_LIST_DIR}/host_tests
|
# TEST_SOURCES
|
||||||
|
# foo.cpp
|
||||||
|
# bar.cpp
|
||||||
|
# TEST_REQUIRED_LIBS
|
||||||
|
# mbed-kvstore
|
||||||
|
# mbed-xyz
|
||||||
|
# HOST_TESTS_DIR
|
||||||
|
# ${CMAKE_CURRENT_LIST_DIR}/host_tests
|
||||||
|
# TEST_SKIPPED
|
||||||
|
# ${skip_reason}
|
||||||
# )
|
# )
|
||||||
|
|
||||||
macro(mbed_greentea_add_test)
|
function(mbed_greentea_add_test)
|
||||||
set(options)
|
set(options)
|
||||||
set(singleValueArgs TEST_NAME)
|
set(singleValueArgs
|
||||||
|
TEST_NAME
|
||||||
|
TEST_SKIPPED
|
||||||
|
)
|
||||||
set(multipleValueArgs
|
set(multipleValueArgs
|
||||||
TEST_INCLUDE_DIRS
|
TEST_INCLUDE_DIRS
|
||||||
TEST_SOURCES
|
TEST_SOURCES
|
||||||
|
@ -46,6 +62,22 @@ macro(mbed_greentea_add_test)
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT "${MBED_GREENTEA_TEST_SKIPPED}" STREQUAL "")
|
||||||
|
add_test(
|
||||||
|
NAME
|
||||||
|
${MBED_GREENTEA_TEST_NAME}
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E echo
|
||||||
|
"Skipping ${MBED_GREENTEA_TEST_NAME}:"
|
||||||
|
"${MBED_GREENTEA_TEST_SKIPPED}"
|
||||||
|
)
|
||||||
|
set_tests_properties(${MBED_GREENTEA_TEST_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
SKIP_REGULAR_EXPRESSION "."
|
||||||
|
)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
# TODO: After we convert all greentea tests to use CTest, remove this
|
# TODO: After we convert all greentea tests to use CTest, remove this
|
||||||
# add_subdirectory call. We will attach the tests to the mbed-os project,
|
# add_subdirectory call. We will attach the tests to the mbed-os project,
|
||||||
# rather than creating a new project for each test that depends on mbed-os.
|
# rather than creating a new project for each test that depends on mbed-os.
|
||||||
|
@ -119,4 +151,4 @@ macro(mbed_greentea_add_test)
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endfunction()
|
||||||
|
|
Loading…
Reference in New Issue