Skip to content

Refactor hal greentea cmake #15056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hal/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
38 changes: 38 additions & 0 deletions hal/tests/TESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(mbed_hal/common_tickers)
add_subdirectory(mbed_hal/common_tickers_freq)
add_subdirectory(mbed_hal/crc)
add_subdirectory(mbed_hal/critical_section)
add_subdirectory(mbed_hal/flash/functional_tests)
add_subdirectory(mbed_hal/lp_ticker)
add_subdirectory(mbed_hal/minimum_requirements)
add_subdirectory(mbed_hal/mpu)
add_subdirectory(mbed_hal/pinmap)
add_subdirectory(mbed_hal/reset_reason)
add_subdirectory(mbed_hal/rtc)
add_subdirectory(mbed_hal/rtc_reset)
add_subdirectory(mbed_hal/rtc_time)
add_subdirectory(mbed_hal/rtc_time_conv)
add_subdirectory(mbed_hal/sleep)
add_subdirectory(mbed_hal/sleep_manager)
add_subdirectory(mbed_hal/sleep_manager_racecondition)
add_subdirectory(mbed_hal/ticker)
add_subdirectory(mbed_hal/trng)
add_subdirectory(mbed_hal/us_ticker)
add_subdirectory(mbed_hal/watchdog)
add_subdirectory(mbed_hal/watchdog_reset)
add_subdirectory(mbed_hal/watchdog_timing)
add_subdirectory(mbed_hal/qspi)
add_subdirectory(mbed_hal/ospi)
add_subdirectory(mbed_hal_fpga_ci_test_shield/analogin)
add_subdirectory(mbed_hal_fpga_ci_test_shield/gpio)
add_subdirectory(mbed_hal_fpga_ci_test_shield/gpio_irq)
add_subdirectory(mbed_hal_fpga_ci_test_shield/i2c)
add_subdirectory(mbed_hal_fpga_ci_test_shield/pwm)
add_subdirectory(mbed_hal_fpga_ci_test_shield/spi)
add_subdirectory(mbed_hal_fpga_ci_test_shield/uart)
add_subdirectory(mbed_timing_fpga_ci_test_shield/watchdog)
add_subdirectory(pin_names/arduino_uno)
add_subdirectory(pin_names/generic)
Comment on lines +4 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of directories! I don't really understand what this commit is for after reading the commit message. Could we add a bit more context as to why we need this? Should it be in a separate commit from "Update hal CMake to include greentea test dir"?

19 changes: 10 additions & 9 deletions hal/tests/TESTS/mbed_hal/common_tickers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-common-tickers)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "UsTicker need to be enabled for this test.")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-common-tickers
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
TEST_SKIPPED
${TEST_SKIPPED}
)
21 changes: 12 additions & 9 deletions hal/tests/TESTS/mbed_hal/common_tickers_freq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-common-tickers-freq)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_USTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "UsTicker need to be enabled for this test.")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-common-tickers-freq
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
HOST_TESTS_DIR
"${CMAKE_CURRENT_LIST_DIR}/../../host_tests"
TEST_SKIPPED
${TEST_SKIPPED}
)
19 changes: 10 additions & 9 deletions hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-crc)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_CRC=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "CRC not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-crc
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
TEST_SKIPPED
${TEST_SKIPPED}
)
15 changes: 5 additions & 10 deletions hal/tests/TESTS/mbed_hal/critical_section/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-hal-critical-section)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
include(mbed_greentea)

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-critical-section
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
)
17 changes: 8 additions & 9 deletions hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-flash-functional-tests)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "Flash API not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-flash-functional-tests
TEST_SOURCES
main.cpp
TEST_SKIPPED
${TEST_SKIPPED}
)
19 changes: 10 additions & 9 deletions hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-lp-ticker)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_LPTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "Low power timer not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-lp-ticker
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
TEST_SKIPPED
${TEST_SKIPPED}
)
13 changes: 3 additions & 10 deletions hal/tests/TESTS/mbed_hal/minimum_requirements/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-hal-minimum-requirements)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
include(mbed_greentea)

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-minimum-requirements
TEST_SOURCES
main.cpp
)
19 changes: 10 additions & 9 deletions hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-mpu)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_MPU=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "MPU API not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-mpu
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
TEST_SKIPPED
${TEST_SKIPPED}
)
18 changes: 9 additions & 9 deletions hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-ospi)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_OSPI=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "OSPI not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-ospi
TEST_SOURCES
main.cpp
ospi_test_utils.cpp
TEST_INCLUDE_DIRS
.
flash_configs
TEST_SKIPPED
${TEST_SKIPPED}
)
13 changes: 3 additions & 10 deletions hal/tests/TESTS/mbed_hal/pinmap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-hal-pinmap)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
include(mbed_greentea)

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-pinmap
TEST_SOURCES
main.cpp
)
15 changes: 7 additions & 8 deletions hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Copyright (c) 2020-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-hal-qspi)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_QSPI=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "QSPI not supported for this target")
endif()

if(TARGET mbed-ep-agora)
set(FLASH_TARGET_CONFIG_HEADER NORDIC/EP_AGORA)
Expand All @@ -31,11 +28,13 @@ list(

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-qspi
TEST_SOURCES
main.cpp
qspi_test_utils.cpp
TEST_INCLUDE_DIRS
${TEST_HEADER_DIRS}
TEST_SKIPPED
${TEST_SKIPPED}
)

21 changes: 12 additions & 9 deletions hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-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-hal-reset-reason)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})
if(NOT "DEVICE_RESET_REASON=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "Reset reason API not supported for this target")
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-hal-reset-reason
TEST_INCLUDE_DIRS
.
TEST_SOURCES
main.cpp
HOST_TESTS_DIR
"${CMAKE_CURRENT_LIST_DIR}/../../host_tests"
TEST_SKIPPED
${TEST_SKIPPED}
)
Loading