Test: Decouple control logic between Core test, IPC test and Regression test

Decouple the control flag and logic between Core test, IPC test and
Regression test.
CORE_TEST, IPC_TEST, REGRESSION can control Core test, IPC test and
Regression test respectively.

Change-Id: I0952e7572abe0229b9a09022484573e8805b16b3
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index aa261c0..259136b 100644
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -11,6 +11,8 @@
 	message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake")
 elseif(NOT DEFINED TFM_LVL)
 	message(FATAL_ERROR "ERROR: Incomplete Configuration: TFM_LVL not defined, Include this file from a Config*.cmake")
+elseif(NOT DEFINED CORE_IPC)
+	message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_IPC not deinfed. Include this file from a Config*.cmake")
 endif()
 
 if(NOT DEFINED COMPILER)
@@ -111,7 +113,6 @@
 set (TEST_FRAMEWORK_NS OFF)
 set (TFM_PSA_API OFF)
 set (TFM_LEGACY_API ON)
-set (CORE_TEST_IPC OFF)
 
 option(TFM_PARTITION_AUDIT_LOG "Enable the TF-M Audit Log partition" ON)
 option(TFM_PARTITION_PLATFORM "Enable the TF-M Platform partition" ON)
@@ -129,6 +130,14 @@
 
 if (CORE_IPC)
 	set(TFM_PSA_API ON)
+
+	# Disable IPC Test by default if the config or platform doesn't explicitly
+	# require it
+	if (NOT DEFINED IPC_TEST)
+		set(IPC_TEST OFF)
+	endif()
+else()
+	set(IPC_TEST OFF)
 endif()
 
 if (TFM_PSA_API)
@@ -142,16 +151,9 @@
 if (SERVICES_TEST_ENABLED)
 	set(SERVICE_TEST_S ON)
 	set(SERVICE_TEST_NS ON)
-	if (CORE_IPC)
-		set(CORE_TEST_IPC ON)
-	endif()
-	set(CORE_TEST_POSITIVE ON)
 endif()
 
 if (CORE_TEST)
-	if (CORE_IPC)
-		set(CORE_TEST_IPC ON)
-	endif()
 	set(CORE_TEST_POSITIVE ON)
 	set(CORE_TEST_INTERACTIVE OFF)
 endif()
@@ -182,8 +184,8 @@
 	set(TFM_ENABLE_IRQ_TEST OFF)
 endif()
 
-if (CORE_TEST_IPC)
-	add_definitions(-DCORE_TEST_IPC)
+if (IPC_TEST)
+	add_definitions(-DENABLE_IPC_TEST)
 	set(TEST_FRAMEWORK_NS ON)
 	set(TFM_PARTITION_TEST_CORE_IPC ON)
 endif()