From 7e3565b5f53ea34d768de666b664676731b8e9cb Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 7 Jul 2021 16:49:54 +0100 Subject: [PATCH] Unit tests: Move cmsis target_h stubs This creates a new mbed-headers-cmsis which is always and only used by mbed-headers-platform, so we add the former to the laters' linked targets. --- cmsis/CMakeLists.txt | 3 +++ cmsis/tests/UNITTESTS/.mbedignore | 1 + cmsis/tests/UNITTESTS/doubles/CMakeLists.txt | 9 +++++++++ .../target_h => cmsis/tests/UNITTESTS/doubles}/cmsis.h | 0 .../tests/UNITTESTS/doubles}/cmsis_compiler.h | 0 .../tests/UNITTESTS/doubles}/cmsis_os.h | 0 .../tests/UNITTESTS/doubles}/cmsis_os2.h | 0 .../tests/UNITTESTS/doubles}/mbed_rtx.h | 0 .../tests/UNITTESTS/doubles}/mbed_rtx_conf.h | 0 .../target_h => cmsis/tests/UNITTESTS/doubles}/rtx_lib.h | 0 .../target_h => cmsis/tests/UNITTESTS/doubles}/rtx_os.h | 0 platform/tests/UNITTESTS/doubles/CMakeLists.txt | 4 ++++ 12 files changed, 17 insertions(+) create mode 100644 cmsis/tests/UNITTESTS/.mbedignore create mode 100644 cmsis/tests/UNITTESTS/doubles/CMakeLists.txt rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/cmsis.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/cmsis_compiler.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/cmsis_os.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/cmsis_os2.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/mbed_rtx.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/mbed_rtx_conf.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/rtx_lib.h (100%) rename {UNITTESTS/target_h => cmsis/tests/UNITTESTS/doubles}/rtx_os.h (100%) diff --git a/cmsis/CMakeLists.txt b/cmsis/CMakeLists.txt index b2442a67a1..ecfe69c76a 100644 --- a/cmsis/CMakeLists.txt +++ b/cmsis/CMakeLists.txt @@ -4,3 +4,6 @@ add_subdirectory(CMSIS_5) add_subdirectory(device) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + add_subdirectory(tests/UNITTESTS/doubles) +endif() diff --git a/cmsis/tests/UNITTESTS/.mbedignore b/cmsis/tests/UNITTESTS/.mbedignore new file mode 100644 index 0000000000..72e8ffc0db --- /dev/null +++ b/cmsis/tests/UNITTESTS/.mbedignore @@ -0,0 +1 @@ +* diff --git a/cmsis/tests/UNITTESTS/doubles/CMakeLists.txt b/cmsis/tests/UNITTESTS/doubles/CMakeLists.txt new file mode 100644 index 0000000000..f220a6fdc1 --- /dev/null +++ b/cmsis/tests/UNITTESTS/doubles/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 Arm Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_library(mbed-headers-cmsis INTERFACE) + +target_include_directories(mbed-headers-cmsis + INTERFACE + . +) diff --git a/UNITTESTS/target_h/cmsis.h b/cmsis/tests/UNITTESTS/doubles/cmsis.h similarity index 100% rename from UNITTESTS/target_h/cmsis.h rename to cmsis/tests/UNITTESTS/doubles/cmsis.h diff --git a/UNITTESTS/target_h/cmsis_compiler.h b/cmsis/tests/UNITTESTS/doubles/cmsis_compiler.h similarity index 100% rename from UNITTESTS/target_h/cmsis_compiler.h rename to cmsis/tests/UNITTESTS/doubles/cmsis_compiler.h diff --git a/UNITTESTS/target_h/cmsis_os.h b/cmsis/tests/UNITTESTS/doubles/cmsis_os.h similarity index 100% rename from UNITTESTS/target_h/cmsis_os.h rename to cmsis/tests/UNITTESTS/doubles/cmsis_os.h diff --git a/UNITTESTS/target_h/cmsis_os2.h b/cmsis/tests/UNITTESTS/doubles/cmsis_os2.h similarity index 100% rename from UNITTESTS/target_h/cmsis_os2.h rename to cmsis/tests/UNITTESTS/doubles/cmsis_os2.h diff --git a/UNITTESTS/target_h/mbed_rtx.h b/cmsis/tests/UNITTESTS/doubles/mbed_rtx.h similarity index 100% rename from UNITTESTS/target_h/mbed_rtx.h rename to cmsis/tests/UNITTESTS/doubles/mbed_rtx.h diff --git a/UNITTESTS/target_h/mbed_rtx_conf.h b/cmsis/tests/UNITTESTS/doubles/mbed_rtx_conf.h similarity index 100% rename from UNITTESTS/target_h/mbed_rtx_conf.h rename to cmsis/tests/UNITTESTS/doubles/mbed_rtx_conf.h diff --git a/UNITTESTS/target_h/rtx_lib.h b/cmsis/tests/UNITTESTS/doubles/rtx_lib.h similarity index 100% rename from UNITTESTS/target_h/rtx_lib.h rename to cmsis/tests/UNITTESTS/doubles/rtx_lib.h diff --git a/UNITTESTS/target_h/rtx_os.h b/cmsis/tests/UNITTESTS/doubles/rtx_os.h similarity index 100% rename from UNITTESTS/target_h/rtx_os.h rename to cmsis/tests/UNITTESTS/doubles/rtx_os.h diff --git a/platform/tests/UNITTESTS/doubles/CMakeLists.txt b/platform/tests/UNITTESTS/doubles/CMakeLists.txt index 31710967ba..cb8bd7fb1b 100644 --- a/platform/tests/UNITTESTS/doubles/CMakeLists.txt +++ b/platform/tests/UNITTESTS/doubles/CMakeLists.txt @@ -10,6 +10,10 @@ target_include_directories(mbed-headers-platform ${mbed-os_SOURCE_DIR}/platform/randlib/include/ ${mbed-os_SOURCE_DIR}/platform/mbed-trace/include ) +target_link_libraries(mbed-headers-platform + INTERFACE + mbed-headers-cmsis +) add_library(mbed-stubs-platform) target_sources(mbed-stubs-platform