From 657b90ea1aa2831a7feed31f07fc8e92213e6465 Mon Sep 17 00:00:00 2001 From: Tamas Ban Date: Fri, 21 Apr 2023 09:31:48 +0200 Subject: [PATCH] fix(tc): enable the execution of both platform tests The C preprocessor cannot compare defines against strings. Such an expression is always evaluated to be true. Therefore, its usage in a conditional expression results that always the first branch is taken. Other branches cannot be reached by any configuration value. The fix removes this string comparison and instead it introduces distinct defines for all the cases. Signed-off-by: Tamas Ban Change-Id: Ia1142b31b6778686c74e1e882fe4604fe3b6501d --- plat/arm/board/tc/include/tc_plat.h | 4 +++- plat/arm/board/tc/platform.mk | 2 +- plat/arm/board/tc/platform_test.mk | 2 +- plat/arm/board/tc/tc_bl31_setup.c | 8 +++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plat/arm/board/tc/include/tc_plat.h b/plat/arm/board/tc/include/tc_plat.h index ba1831fb3..195366e48 100644 --- a/plat/arm/board/tc/include/tc_plat.h +++ b/plat/arm/board/tc/include/tc_plat.h @@ -9,8 +9,10 @@ void tc_bl31_common_platform_setup(void); -#ifdef PLATFORM_TEST +#ifdef PLATFORM_TEST_TFM_TESTSUITE void run_platform_tests(void); +#endif +#ifdef PLATFORM_TEST_NV_COUNTERS void nv_counter_test(void); #endif diff --git a/plat/arm/board/tc/platform.mk b/plat/arm/board/tc/platform.mk index 7fdc4fd84..7171c2454 100644 --- a/plat/arm/board/tc/platform.mk +++ b/plat/arm/board/tc/platform.mk @@ -209,7 +209,7 @@ ifeq (${PLATFORM_TEST},rss-nv-counters) PLAT_INCLUDES += -Iinclude/lib/psa - $(eval $(call add_define,PLATFORM_TEST)) + $(eval $(call add_define,PLATFORM_TEST_NV_COUNTERS)) else ifeq (${PLATFORM_TEST},tfm-testsuite) # Add this include as first, before arm_common.mk. This is necessary # because arm_common.mk builds Mbed TLS, and platform_test.mk can diff --git a/plat/arm/board/tc/platform_test.mk b/plat/arm/board/tc/platform_test.mk index 5cdbb86be..e974855ad 100644 --- a/plat/arm/board/tc/platform_test.mk +++ b/plat/arm/board/tc/platform_test.mk @@ -76,5 +76,5 @@ ifeq (${PLATFORM_TEST},tfm-testsuite) $(eval $(call add_define,MEASURED_BOOT_HASH_ALG)) $(eval $(call add_define,DELEG_ATTEST_DUMP_TOKEN_AND_KEY)) - $(eval $(call add_define,PLATFORM_TEST)) + $(eval $(call add_define,PLATFORM_TEST_TFM_TESTSUITE)) endif diff --git a/plat/arm/board/tc/tc_bl31_setup.c b/plat/arm/board/tc/tc_bl31_setup.c index 1c1e2fb2a..aa88f7f3d 100644 --- a/plat/arm/board/tc/tc_bl31_setup.c +++ b/plat/arm/board/tc/tc_bl31_setup.c @@ -53,15 +53,13 @@ void tc_bl31_common_platform_setup(void) { arm_bl31_platform_setup(); -#ifdef PLATFORM_TEST -#if PLATFORM_TEST == rss-nv-counters +#ifdef PLATFORM_TEST_NV_COUNTERS nv_counter_test(); -#elif PLATFORM_TEST == tfm-testsuite - run_platform_tests() +#elif PLATFORM_TEST_TFM_TESTSUITE + run_platform_tests(); #endif /* Suspend booting */ plat_error_handler(-1); -#endif } const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops) -- 2.39.5