blob: 1220cce6ffd85fc641d231c263fbd5b306f300b8 [file] [log] [blame]
David Hu12f25872021-08-23 14:55:46 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2021, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8get_cmake_property(CACHE_VARS CACHE_VARIABLES)
9
10# By default all non-secure regression tests are disabled.
11# If TEST_NS or TEST_NS_XXX flag is passed via command line and set to ON,
12# selected corresponding features to support non-secure regression tests.
13foreach(CACHE_VAR ${CACHE_VARS})
14 string(REGEX MATCH "^TEST_NS.*" _NS_TEST_FOUND "${CACHE_VAR}")
15 if (_NS_TEST_FOUND AND "${${CACHE_VAR}}")
16 # TFM_NS_REG_TEST is a TF-M internal cmake flag to manage building
17 # tf-m-tests non-secure regression tests related source
18 set(TFM_NS_REG_TEST ON)
19 break()
20 endif()
21endforeach()
22
23# By default all secure regression tests are disabled.
24# If TEST_S or TEST_S_XXX flag is passed via command line and set to ON,
25# selected corresponding features to support secure regression tests.
26foreach(CACHE_VAR ${CACHE_VARS})
27 string(REGEX MATCH "^TEST_S.*" _S_TEST_FOUND "${CACHE_VAR}")
28 if (_S_TEST_FOUND AND "${${CACHE_VAR}}")
29 # TFM_S_REG_TEST is a TF-M internal cmake flag to manage building
30 # tf-m-tests secure regression tests related source
31 set(TFM_S_REG_TEST ON)
32 break()
33 endif()
34endforeach()
35
36# If NS app, secure regression test or non-secure regression test is enabled,
37# fetch tf-m-tests repo.
38# The conditiions are actually overlapped but it can make the logic more clear.
39# Besides, the dependencies between NS app and regression tests will be
40# optimized later.
41if (NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST)
42 # Set tf-m-tests repo config
43 include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/repo_config_default.cmake)
44 # Fetch tf-m-tests repo
45 include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/fetch_repo.cmake)
46endif()