BL1: Add extra tests options for BL1_1 and BL1_2

Change-Id: I201c89bfc959630396179e13974de0984204ba75
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/docs/tfm_test_suites_addition.rst b/docs/tfm_test_suites_addition.rst
index 4bb5751..7557796 100644
--- a/docs/tfm_test_suites_addition.rst
+++ b/docs/tfm_test_suites_addition.rst
@@ -290,7 +290,7 @@
 **********************************
 
 TF-M supports out-of-tree regression test suites build, whose source code
-folder is outside tf-m-tests repo. There are two configurations for developers
+folder is outside tf-m-tests repo. There are four configurations for developers
 to include the source code.
 
 - ``EXTRA_NS_TEST_SUITE_PATH``
@@ -304,6 +304,16 @@
   An absolute directory of the out-of-tree secure test suite
   source code folder.
 
+- ``EXTRA_BL1_1_TEST_SUITE_PATH``
+
+  An absolute directory of the out-of-tree BL1_1 test suite
+  source code folder.
+
+- ``EXTRA_BL1_2_TEST_SUITE_PATH``
+
+  An absolute directory of the out-of-tree BL1_2 test suite
+  source code folder.
+
 Example usage
 =============
 
diff --git a/tests_reg/test/bl1/bl1_1/CMakeLists.txt b/tests_reg/test/bl1/bl1_1/CMakeLists.txt
index 4a2095e..ef898f0 100644
--- a/tests_reg/test/bl1/bl1_1/CMakeLists.txt
+++ b/tests_reg/test/bl1/bl1_1/CMakeLists.txt
@@ -9,6 +9,8 @@
     return()
 endif()
 
+add_library(bl1_1_tests STATIC)
+
 set(LOG_SOURCE_ROOT ${TFM_TESTS_ROOT_DIR}/lib/log)
 
 add_library(bl1_1_log INTERFACE)
@@ -36,8 +38,7 @@
 add_subdirectory(suites/crypto)
 add_subdirectory(suites/trng)
 add_subdirectory(suites/integration)
-
-add_library(bl1_1_tests STATIC)
+add_subdirectory(suites/extra)
 
 target_sources(bl1_1_tests
     PRIVATE
diff --git a/tests_reg/test/bl1/bl1_1/bl1_1_suites.c b/tests_reg/test/bl1/bl1_1/bl1_1_suites.c
index abfcc94..bd34127 100644
--- a/tests_reg/test/bl1/bl1_1/bl1_1_suites.c
+++ b/tests_reg/test/bl1/bl1_1/bl1_1_suites.c
@@ -10,6 +10,11 @@
 #include "bl1_1_crypto_tests.h"
 #include "bl1_1_trng_tests.h"
 #include "bl1_1_integration_tests.h"
+#include "extra_bl1_1_tests.h"
+
+#ifdef EXTRA_BL1_1_TEST_SUITE
+#include "extra_bl1_1_tests.h"
+#endif /* EXTRA_BL1_1_TEST_SUITE */
 
 static struct test_suite_t test_suites[] = {
 
@@ -17,6 +22,11 @@
     {&register_testsuite_bl1_trng_interface, 0, 0, 0},
     {&register_testsuite_bl1_1_integration, 0, 0, 0},
 
+#ifdef EXTRA_BL1_1_TEST_SUITE
+    /* BL1_1 extra test cases */
+    {&register_testsuite_extra_bl1_1, 0, 0, 0},
+#endif
+
     /* End of test suites */
     {0, 0, 0, 0}
 };
diff --git a/tests_reg/test/bl1/bl1_1/suites/extra/CMakeLists.txt b/tests_reg/test/bl1/bl1_1/suites/extra/CMakeLists.txt
new file mode 100644
index 0000000..7ebaea1
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_1/suites/extra/CMakeLists.txt
@@ -0,0 +1,36 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2024, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if(NOT EXTRA_BL1_1_TEST_SUITE_PATH)
+    return()
+endif()
+
+add_library(tfm_test_suite_extra_bl1_1 STATIC)
+
+target_include_directories(tfm_test_suite_extra_bl1_1
+    PUBLIC
+        .
+)
+
+target_compile_definitions(tfm_test_suite_extra_bl1_1
+    INTERFACE
+        EXTRA_BL1_1_TEST_SUITE
+)
+
+target_link_libraries(tfm_test_suite_extra_bl1_1
+    PRIVATE
+        tfm_test_framework_common
+        platform_bl1_1_interface
+)
+
+target_link_libraries(bl1_1_tests
+    PUBLIC
+        tfm_test_suite_extra_bl1_1
+)
+
+# Add extra test suites source from outside
+include(extra_bl1_1_tests_config.cmake)
diff --git a/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests.h b/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests.h
new file mode 100644
index 0000000..ccb85e9
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __EXTRA_BL1_1_TESTS_H__
+#define __EXTRA_BL1_1_TESTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test_framework.h"
+
+/**
+ * \brief Register testsuite for the extra bl1_1 tests.
+ *
+ * \param[in] p_test_suite The test suite to be executed.
+ */
+void register_testsuite_extra_bl1_1(struct test_suite_t *p_test_suite);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __EXTRA_BL1_1_TESTS_H__ */
diff --git a/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests_config.cmake b/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests_config.cmake
new file mode 100644
index 0000000..46e7973
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_1/suites/extra/extra_bl1_1_tests_config.cmake
@@ -0,0 +1,16 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+########################## load extra BL1_1 test suites source #################
+
+# load source
+get_filename_component(EXTRA_BL1_1_TEST_SUITE_NAME ${EXTRA_BL1_1_TEST_SUITE_PATH} NAME_WLE)
+
+# load subdirectories
+set(TEMP_BINARY_EXTRA_BL1_1_TEST_SUITE
+    "${CMAKE_CURRENT_BINARY_DIR}/${EXTRA_BL1_1_TEST_SUITE_NAME}")
+add_subdirectory(${EXTRA_BL1_1_TEST_SUITE_PATH} ${TEMP_BINARY_EXTRA_BL1_1_TEST_SUITE})
diff --git a/tests_reg/test/bl1/bl1_2/CMakeLists.txt b/tests_reg/test/bl1/bl1_2/CMakeLists.txt
index d662805..d4fc41b 100644
--- a/tests_reg/test/bl1/bl1_2/CMakeLists.txt
+++ b/tests_reg/test/bl1/bl1_2/CMakeLists.txt
@@ -9,10 +9,11 @@
     return()
 endif()
 
-add_subdirectory(suites/integration)
-
 add_library(bl1_2_tests STATIC)
 
+add_subdirectory(suites/integration)
+add_subdirectory(suites/extra)
+
 target_sources(bl1_2_tests
     PRIVATE
         ./bl1_2_suites.c
diff --git a/tests_reg/test/bl1/bl1_2/bl1_2_suites.c b/tests_reg/test/bl1/bl1_2/bl1_2_suites.c
index 701808c..a64dbb5 100644
--- a/tests_reg/test/bl1/bl1_2/bl1_2_suites.c
+++ b/tests_reg/test/bl1/bl1_2/bl1_2_suites.c
@@ -9,10 +9,20 @@
 
 #include "bl1_2_integration_tests.h"
 
+#ifdef EXTRA_BL1_2_TEST_SUITE
+#include "extra_bl1_2_tests.h"
+#endif /* EXTRA_BL1_2_TEST_SUITE */
+
 static struct test_suite_t test_suites[] = {
 
     {&register_testsuite_bl1_2_integration, 0, 0, 0},
 
+#ifdef EXTRA_BL1_2_TEST_SUITE
+    /* Bl1_2 extra test cases */
+    {&register_testsuite_extra_bl1_2, 0, 0, 0},
+#endif
+
+
     /* End of test suites */
     {0, 0, 0, 0}
 };
diff --git a/tests_reg/test/bl1/bl1_2/suites/extra/CMakeLists.txt b/tests_reg/test/bl1/bl1_2/suites/extra/CMakeLists.txt
new file mode 100644
index 0000000..b453e8a
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_2/suites/extra/CMakeLists.txt
@@ -0,0 +1,36 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2024, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if(NOT EXTRA_BL1_2_TEST_SUITE_PATH)
+    return()
+endif()
+
+add_library(tfm_test_suite_extra_bl1_2 STATIC)
+
+target_include_directories(tfm_test_suite_extra_bl1_2
+    PUBLIC
+        .
+)
+
+target_compile_definitions(tfm_test_suite_extra_bl1_2
+    INTERFACE
+        EXTRA_BL1_2_TEST_SUITE
+)
+
+target_link_libraries(tfm_test_suite_extra_bl1_2
+    PRIVATE
+        tfm_test_framework_common
+        platform_bl1_1_interface
+)
+
+target_link_libraries(bl1_2_tests
+    PUBLIC
+        tfm_test_suite_extra_bl1_2
+)
+
+# Add extra test suites source from outside
+include(extra_bl1_2_tests_config.cmake)
diff --git a/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests.h b/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests.h
new file mode 100644
index 0000000..8838da5
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __EXTRA_BL1_2_TESTS_H__
+#define __EXTRA_BL1_2_TESTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test_framework.h"
+
+/**
+ * \brief Register testsuite for the extra bl1_2 tests.
+ *
+ * \param[in] p_test_suite The test suite to be executed.
+ */
+void register_testsuite_extra_bl1_2(struct test_suite_t *p_test_suite);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __EXTRA_BL1_2_TESTS_H__ */
diff --git a/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests_config.cmake b/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests_config.cmake
new file mode 100644
index 0000000..98ab742
--- /dev/null
+++ b/tests_reg/test/bl1/bl1_2/suites/extra/extra_bl1_2_tests_config.cmake
@@ -0,0 +1,16 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+########################## load extra BL1_2 test suites source #################
+
+# load source
+get_filename_component(EXTRA_BL1_2_TEST_SUITE_NAME ${EXTRA_BL1_2_TEST_SUITE_PATH} NAME_WLE)
+
+# load subdirectories
+set(TEMP_BINARY_EXTRA_BL1_2_TEST_SUITE
+    "${CMAKE_CURRENT_BINARY_DIR}/${EXTRA_BL1_2_TEST_SUITE_NAME}")
+add_subdirectory(${EXTRA_BL1_2_TEST_SUITE_PATH} ${TEMP_BINARY_EXTRA_BL1_2_TEST_SUITE})
diff --git a/tests_reg/test/config/default_test_config.cmake b/tests_reg/test/config/default_test_config.cmake
index 6643d46..2cdd8bd 100644
--- a/tests_reg/test/config/default_test_config.cmake
+++ b/tests_reg/test/config/default_test_config.cmake
@@ -45,8 +45,3 @@
 set(TFM_FWU_TEST_REQUEST_REBOOT         OFF         CACHE BOOL      "Test psa_fwu_request_reboot")
 set(TFM_FWU_TEST_WRITE_WITH_NULL        OFF         CACHE BOOL      "Test psa_fwu_write with data block NULL")
 set(TFM_FWU_TEST_QUERY_WITH_NULL        OFF         CACHE BOOL      "Test psa_fwu_query with info NULL")
-
-################################## Extra test suites ###########################
-
-set(EXTRA_NS_TEST_SUITE_PATH            ""          CACHE PATH      "List of extra non-secure test suites directories. An extra test suite folder contains source code, CMakeLists.txt and cmake configuration file")
-set(EXTRA_S_TEST_SUITE_PATH             ""          CACHE PATH      "List of extra secure test suites directories. An extra test suite folder contains source code, CMakeLists.txt and cmake configuration file")