CMake: Add options to build generated TF-Fuzz suite

Change-Id: I989f89d8971b5d12c2204a88786088657c3e331e
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
Signed-off-by: Karl Zhang <karl.zhang@arm.com>
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 30d2356..0594e98 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -40,6 +40,16 @@
     add_subdirectory(suites/multi_core)
 endif()
 
+if (TFM_FUZZER_TOOL_TESTS)
+    if(NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH)
+        # The location of the file needs to be defined either from command line
+        # or from config cmake file.
+        message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.")
+    else()
+        add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz)
+    endif()
+endif()
+
 add_library(tfm_test_framework_common INTERFACE)
 
 target_sources(tfm_test_framework_common
@@ -77,6 +87,7 @@
     INTERFACE
         $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
         $<$<BOOL:${TFM_INTERACTIVE_TEST}>:CORE_TEST_INTERACTIVE>
+        $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS>
 )
 
 ####################### Secure #################################################
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 0d29063..a599c7e 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -43,6 +43,9 @@
 #ifdef TFM_MULTI_CORE_TOPOLOGY
 #include "multi_core_ns_test.h"
 #endif /* TFM_MULTI_CORE_TOPOLOGY */
+#ifdef TFM_FUZZER_TOOL_TESTS
+#include "tf_fuzz_testsuite.h"
+#endif /* TFM_FUZZER_TOOL_TESTS */
 
 static struct test_suite_t test_suites[] = {
     /* List test cases which are compliant with level 1 isolation */
@@ -107,6 +110,10 @@
     {&register_testsuite_multi_core_ns_interface, 0, 0, 0},
 #endif
 
+#ifdef TFM_FUZZER_TOOL_TESTS
+    {&register_testsuite_tf_fuzz_test, 0, 0, 0},
+#endif /* TFM_FUZZER_TOOL_TESTS */
+
     /* End of test suites */
     {0, 0, 0, 0}
 };