diff options
author | David Hu <david.hu@arm.com> | 2021-08-23 14:55:46 +0800 |
---|---|---|
committer | David Hu <david.hu@arm.com> | 2021-09-06 07:25:23 +0200 |
commit | 12f2587d39cd87c07d49cb77dfd9ec0bb3bdcf38 (patch) | |
tree | 2d80a77a165bb25b1a37d3ce767c361f5fb2e2d6 /lib/ext/tf-m-tests | |
parent | 41ff07460d43f99708ef14fbcf978312b763a814 (diff) | |
download | trusted-firmware-m-12f2587d39cd87c07d49cb77dfd9ec0bb3bdcf38.tar.gz |
Build: Simplify TF-M regression test config parse
Search regression test config passed via command line. If regression
test flags are found in CMake cache variables and values are set to ON,
enable corresponding regression test flag in TF-M build.
It can get rid of long list in if condition check of regression test
configs. Developers only need to name regression test group starting
with "TEST_NS" or "TEST_S", without updating the long if condition
check.
Change-Id: I83f0589390d2120afe94feb9f0867f4aa8187202
Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'lib/ext/tf-m-tests')
-rw-r--r-- | lib/ext/tf-m-tests/tf-m-tests.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/ext/tf-m-tests/tf-m-tests.cmake b/lib/ext/tf-m-tests/tf-m-tests.cmake new file mode 100644 index 0000000000..1220cce6ff --- /dev/null +++ b/lib/ext/tf-m-tests/tf-m-tests.cmake @@ -0,0 +1,46 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2021, Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +#------------------------------------------------------------------------------- + +get_cmake_property(CACHE_VARS CACHE_VARIABLES) + +# By default all non-secure regression tests are disabled. +# If TEST_NS or TEST_NS_XXX flag is passed via command line and set to ON, +# selected corresponding features to support non-secure regression tests. +foreach(CACHE_VAR ${CACHE_VARS}) + string(REGEX MATCH "^TEST_NS.*" _NS_TEST_FOUND "${CACHE_VAR}") + if (_NS_TEST_FOUND AND "${${CACHE_VAR}}") + # TFM_NS_REG_TEST is a TF-M internal cmake flag to manage building + # tf-m-tests non-secure regression tests related source + set(TFM_NS_REG_TEST ON) + break() + endif() +endforeach() + +# By default all secure regression tests are disabled. +# If TEST_S or TEST_S_XXX flag is passed via command line and set to ON, +# selected corresponding features to support secure regression tests. +foreach(CACHE_VAR ${CACHE_VARS}) + string(REGEX MATCH "^TEST_S.*" _S_TEST_FOUND "${CACHE_VAR}") + if (_S_TEST_FOUND AND "${${CACHE_VAR}}") + # TFM_S_REG_TEST is a TF-M internal cmake flag to manage building + # tf-m-tests secure regression tests related source + set(TFM_S_REG_TEST ON) + break() + endif() +endforeach() + +# If NS app, secure regression test or non-secure regression test is enabled, +# fetch tf-m-tests repo. +# The conditiions are actually overlapped but it can make the logic more clear. +# Besides, the dependencies between NS app and regression tests will be +# optimized later. +if (NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST) + # Set tf-m-tests repo config + include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/repo_config_default.cmake) + # Fetch tf-m-tests repo + include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/fetch_repo.cmake) +endif() |