Split Build: Enable IRQ Test suites
1. Add include directory within test Partitions directly to NS libraries
instead of linking the corresponding library as the library wouldn't be
available when building NS
2. Use TFM_PARTITION_xLIH_TEST in test Secure Partition building
Change-Id: Ia60aeef90e3e685893a0195a944e116b008fcc8f
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.c b/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.c
index 219e3aa..d2daedc 100644
--- a/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.c
+++ b/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.c
@@ -11,7 +11,7 @@
#include "tfm_plat_test.h"
#include "psa/service.h"
-#ifdef TEST_NS_FLIH_IRQ
+#ifdef TFM_PARTITION_FLIH_TEST
/* The execution flow ensures there are no race conditions for test_type */
static int32_t test_type = TFM_FLIH_TEST_CASE_INVALID;
/*
@@ -86,9 +86,9 @@
psa_reset_signal(timer_irq_signal);
psa_irq_disable(timer_irq_signal);
}
-#endif /* TEST_NS_FLIH_IRQ */
+#endif /* TFM_PARTITION_FLIH_TEST */
-#ifdef TEST_NS_SLIH_IRQ
+#ifdef TFM_PARTITION_SLIH_TEST
static void slih_test_timer_handler(psa_signal_t timer_irq_signal)
{
tfm_plat_test_secure_timer_stop();
@@ -108,4 +108,4 @@
slih_test_timer_handler(timer_irq_signal);
}
-#endif /* TEST_NS_SLIH_IRQ */
+#endif /* TFM_PARTITION_SLIH_TEST */
diff --git a/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.h b/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.h
index 8864335..02a243e 100644
--- a/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.h
+++ b/tests_reg/test/secure_fw/suites/spm/common/service/tfm_irq_test_service.h
@@ -11,14 +11,14 @@
#include <stdint.h>
#include "psa/service.h"
-#ifdef TEST_NS_SLIH_IRQ
+#ifdef TFM_PARTITION_SLIH_TEST
void slih_test_case_1(const psa_msg_t *msg, psa_signal_t timer_irq_signal);
-#endif /* TEST_NS_SLIH_IRQ */
+#endif /* TFM_PARTITION_SLIH_TEST */
-#ifdef TEST_NS_FLIH_IRQ
+#ifdef TFM_PARTITION_FLIH_TEST
psa_flih_result_t tfm_flih_test_timer_handler(void);
void flih_test_case_1(const psa_msg_t *msg, psa_signal_t timer_irq_signal);
void flih_test_case_2(const psa_msg_t *msg, psa_signal_t timer_irq_signal);
-#endif /* TEST_NS_FLIH_IRQ */
+#endif /* TFM_PARTITION_FLIH_TEST */
#endif /* __TFM_IRQ_TEST_SERVICE_H__ */
diff --git a/tests_reg/test/secure_fw/suites/spm/common/spm_test_defs.h b/tests_reg/test/secure_fw/suites/spm/common/spm_test_defs.h
index 5cfbbc5..6ace104 100644
--- a/tests_reg/test/secure_fw/suites/spm/common/spm_test_defs.h
+++ b/tests_reg/test/secure_fw/suites/spm/common/spm_test_defs.h
@@ -27,14 +27,17 @@
#endif /* PSA_FRAMEWORK_HAS_MM_IOVEC */
/* IRQ test service types [0x200, 0x2FF] */
-#ifdef TEST_NS_FLIH_IRQ
+
+/* Different config options used by NS and S build respectively */
+#if (defined TEST_NS_FLIH_IRQ) || (defined TFM_PARTITION_FLIH_TEST)
#define TFM_FLIH_TEST_CASE_INVALID (0x200)
#define TFM_FLIH_TEST_CASE_1 (0x201)
#define TFM_FLIH_TEST_CASE_2 (0x202)
-#endif /* TEST_NS_FLIH_IRQ */
+#endif /* (defined TEST_NS_FLIH_IRQ) || (defined TFM_PARTITION_FLIH_TEST) */
-#ifdef TEST_NS_SLIH_IRQ
+/* Different config options used by NS and S build respectively */
+#if (defined TEST_NS_SLIH_IRQ) || (defined TFM_PARTITION_SLIH_TEST)
#define TFM_SLIH_TEST_CASE_1 (0x203)
-#endif /* TEST_NS_SLIH_IRQ */
+#endif /* (defined TEST_NS_SLIH_IRQ) || (defined TFM_PARTITION_SLIH_TEST) */
#endif /* __TFM_SPM_COMMON_TEST_DEFS_H__ */
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/CMakeLists.txt b/tests_reg/test/secure_fw/suites/spm/irq/CMakeLists.txt
index 55895f9..c1321f4 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/CMakeLists.txt
+++ b/tests_reg/test/secure_fw/suites/spm/irq/CMakeLists.txt
@@ -25,6 +25,9 @@
target_include_directories(tfm_test_suite_irq
PUBLIC
./
+ PRIVATE
+ $<$<BOOL:${TEST_NS_SLIH_IRQ}>:${CMAKE_CURRENT_LIST_DIR}/service/tfm_slih_test_service>
+ $<$<BOOL:${TEST_NS_FLIH_IRQ}>:${CMAKE_CURRENT_LIST_DIR}/service/tfm_flih_test_service>
)
target_compile_definitions(tfm_test_suite_irq
@@ -36,8 +39,6 @@
target_link_libraries(tfm_test_suite_irq
PRIVATE
tfm_test_framework_ns
- $<$<BOOL:${TEST_NS_FLIH_IRQ}>:tfm_flih_test_service_interface>
- $<$<BOOL:${TEST_NS_SLIH_IRQ}>:tfm_slih_test_service_interface>
platform_ns
spm_test_common
)
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/service/CMakeLists.txt b/tests_reg/test/secure_fw/suites/spm/irq/service/CMakeLists.txt
index 0233ffe..a41a52f 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/service/CMakeLists.txt
+++ b/tests_reg/test/secure_fw/suites/spm/irq/service/CMakeLists.txt
@@ -5,10 +5,10 @@
#
#-------------------------------------------------------------------------------
-if (TEST_NS_SLIH_IRQ)
+if (TFM_PARTITION_SLIH_TEST)
add_subdirectory(tfm_slih_test_service)
endif()
-if (TEST_NS_FLIH_IRQ)
+if (TFM_PARTITION_FLIH_TEST)
add_subdirectory(tfm_flih_test_service)
endif()
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/CMakeLists.txt b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/CMakeLists.txt
index 036c3a5..c59ee2a 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/CMakeLists.txt
+++ b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/CMakeLists.txt
@@ -13,8 +13,7 @@
target_sources(tfm_app_rot_partition_flih_test
PRIVATE
./tfm_flih_test_service.c
- $<$<BOOL:${TEST_NS_FLIH_IRQ}>:
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/service/tfm_irq_test_service.c>
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/service/tfm_irq_test_service.c
)
# The generated sources
@@ -60,5 +59,5 @@
target_compile_definitions(tfm_config
INTERFACE
- $<$<BOOL:${TEST_NS_FLIH_IRQ}>:TEST_NS_FLIH_IRQ>
+ TFM_PARTITION_FLIH_TEST
)
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/CMakeLists.txt b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/CMakeLists.txt
index 38806e5..fdad447 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/CMakeLists.txt
+++ b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/CMakeLists.txt
@@ -13,8 +13,7 @@
target_sources(tfm_app_rot_partition_slih_test
PRIVATE
./tfm_slih_test_service.c
- $<$<BOOL:${TEST_NS_SLIH_IRQ}>:
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/service/tfm_irq_test_service.c>
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../common/service/tfm_irq_test_service.c
)
# The generated sources
@@ -43,14 +42,6 @@
tfm_app_rot_partition_slih_test
)
-# Interfaces for other targets
-add_library(tfm_slih_test_service_interface INTERFACE)
-
-target_include_directories(tfm_slih_test_service_interface
- INTERFACE
- ./
-)
-
############################ Partition Defs ####################################
target_link_libraries(tfm_partitions
@@ -60,5 +51,5 @@
target_compile_definitions(tfm_config
INTERFACE
- $<$<BOOL:${TEST_NS_SLIH_IRQ}>:TEST_NS_SLIH_IRQ>
+ TFM_PARTITION_SLIH_TEST
)