Build: Decouple S/NS test control in build configs

Regression tests for both Secure and Non-Secure are currently controlled
by the same boolean seed param "test_regression", which makes the tests
can only be enabled/disable at the same time.

Now that it is needed by some platforms such as Corstone1000 to only
enable Secure tests without Non-Secure tests, the test control needs to
be decoupled.

This patch converts "test_regression" from boolean to string to indicate
which tests should be enabled.

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I1e73dc5d7bca7239fcdd2050bb5e58389a79ad95
diff --git a/build_helper/build_helper_config_maps.py b/build_helper/build_helper_config_maps.py
index 146d48a..649ddbb 100644
--- a/build_helper/build_helper_config_maps.py
+++ b/build_helper/build_helper_config_maps.py
@@ -36,6 +36,13 @@
     "stm/nucleo_l552ze_q"                : "nucleo_l552ze_q",
 }
 
+# Map regression test parameters to short format
+mapRegTest = {
+    "OFF"       : "-DTEST_S=OFF -DTEST_NS=OFF ",
+    "RegS"      : "-DTEST_S=ON ",
+    "RegNS"     : "-DTEST_NS=ON ",
+}
+
 # Map PSA Arch Tests to short format
 mapTestPsaApi = {
     "IPC"                : "FF",
@@ -80,7 +87,7 @@
     # Corstone1000 support
     "FVP"          : "-DPLATFORM_IS_FVP=True ",
     "FPGA"         : "-DPLATFORM_IS_FVP=False -DTEST_S_PS=OFF -DTEST_S_PLATFORM=OFF ",
-    "CS1K_TEST"    : ("-DTEST_BL2=ON -DTEST_S=ON -DTEST_S_IPC=OFF "
+    "CS1K_TEST"    : ("-DTEST_S_IPC=OFF "
                       "-DEXTRA_S_TEST_SUITE_PATH=%(codebase_root_dir)s/platform/ext/target/arm/corstone1000/ci_regression_tests/ "),
 
     # Extra test cases
diff --git a/build_helper/build_helper_configs.py b/build_helper/build_helper_configs.py
index 0fccd48..34b6b6a 100755
--- a/build_helper/build_helper_configs.py
+++ b/build_helper/build_helper_configs.py
@@ -49,7 +49,7 @@
         "-DTFM_PLATFORM=%(tfm_platform)s " + \
         "-DTFM_TOOLCHAIN_FILE=%(codebase_root_dir)s/%(compiler)s " + \
         "-DTFM_ISOLATION_LEVEL=%(isolation_level)s " + \
-        "-DTEST_NS=%(test_regression)s -DTEST_S=%(test_regression)s -DTEST_NS_FLIH_IRQ=OFF " + \
+        "%(test_regression)s " + \
         "-DCMAKE_BUILD_TYPE=%(cmake_build_type)s " + \
         "-DTEST_PSA_API=%(test_psa_api)s " + \
         "-DBL2=%(with_bl2)s " + \
@@ -163,8 +163,8 @@
 # List of all build configs that are impossible under all circumstances
 _common_tfm_invalid_configs = [
     # LR_CODE size exceeds limit on MUSCA_B1 & MUSCA_S1 with regression tests in Debug mode built with ARMCLANG
-    ("arm/musca_b1", "ARMCLANG_6_13", "*", True, "OFF", "Debug", "*", "", "*"),
-    ("arm/musca_s1", "ARMCLANG_6_13", "*", True, "OFF", "Debug", "*", "", "*"),
+    ("arm/musca_b1", "ARMCLANG_6_13", "*", "RegS, RegNS", "OFF", "Debug", "*", "", "*"),
+    ("arm/musca_s1", "ARMCLANG_6_13", "*", "RegS, RegNS", "OFF", "Debug", "*", "", "*"),
     # Load range overlap on Musca for IPC Debug type: T895
     ("arm/musca_b1", "ARMCLANG_6_13", "*", "*", "IPC", "Debug", "*", "*", "*"),
     ("arm/musca_s1", "ARMCLANG_6_13", "*", "*", "IPC", "Debug", "*", "*", "*"),
@@ -182,11 +182,11 @@
 # Configure build manager to build several combinations
 # Config group for per-patch job
 config_pp_test = {"seed_params": {
-                # AN519_ARMCLANG_IPC_1_REG_Debug_BL2
+                # AN519_ARMCLANG_IPC_1_RegS_RegNS_Debug_BL2
                 "tfm_platform":     ["arm/mps2/an519"],
                 "compiler":         ["ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -195,87 +195,87 @@
                 },
                 "common_params": _common_tfm_builder_cfg,
                 "valid": [
-                    # AN519_ARMCLANG_2_REG_Release_BL2
+                    # AN519_ARMCLANG_2_RegS_RegNS_Release_BL2
                     ("arm/mps2/an519", "ARMCLANG_6_13", "2",
-                     True, "OFF", "Release", True, "",  ""),
-                    # AN519_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "",  ""),
+                    # AN519_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/mps2/an519", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "",  ""),
-                    # AN519_GCC_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "",  ""),
+                    # AN519_GCC_2_RegS_RegNS_Release_BL2
                     ("arm/mps2/an519", "GCC_10_3", "2",
-                     True, "OFF", "Release", True, "", ""),
-                    # AN519_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # AN519_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/mps2/an519", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # AN521_ARMCLANG_1_REG_Debug_BL2_SMALL_PSOFF
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # AN521_ARMCLANG_1_RegS_RegNS_Debug_BL2_SMALL_PSOFF
                     ("arm/mps2/an521", "ARMCLANG_6_13", "1",
-                     True, "OFF", "Debug", True, "profile_small", "PSOFF"),
-                    # AN521_ARMCLANG_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "profile_small", "PSOFF"),
+                    # AN521_ARMCLANG_1_RegS_RegNS_Debug_BL2
                     ("arm/mps2/an521", "ARMCLANG_6_13", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # AN521_ARMCLANG_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # AN521_ARMCLANG_2_RegS_RegNS_Release_BL2
                     ("arm/mps2/an521", "ARMCLANG_6_13", "2",
-                     True, "OFF", "Release", True, "", ""),
-                    # AN521_ARMCLANG_3_REG_Minsizerel_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # AN521_ARMCLANG_3_RegS_RegNS_Minsizerel_BL2
                     ("arm/mps2/an521", "ARMCLANG_6_13", "3",
-                     True, "OFF", "Minsizerel", True, "", ""),
-                    # AN521_ARMCLANG_1_REG_Debug_BL2_SMALL_PSOFF
+                     "RegS, RegNS", "OFF", "Minsizerel", True, "", ""),
+                    # AN521_ARMCLANG_1_RegS_RegNS_Debug_BL2_SMALL_PSOFF
                     ("arm/mps2/an521", "ARMCLANG_6_13", "1",
-                     True, "OFF", "Debug", True, "profile_small", "PSOFF"),
-                    # AN521_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "profile_small", "PSOFF"),
+                    # AN521_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/mps2/an521", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
                     # AN521_GCC_2_Debug_BL2_MEDIUM
                     ("arm/mps2/an521", "GCC_10_3", "2",
-                     False, "OFF", "Debug", True, "profile_medium", ""),
-                    # AN521_GCC_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "profile_medium", ""),
+                    # AN521_GCC_2_RegS_RegNS_Release_BL2
                     ("arm/mps2/an521", "GCC_10_3", "2",
-                     True, "OFF", "Release", True, "", ""),
-                    # AN521_GCC_3_REG_Minsizerel_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # AN521_GCC_3_RegS_RegNS_Minsizerel_BL2
                     ("arm/mps2/an521", "GCC_10_3", "3",
-                     True, "OFF", "Minsizerel", True, "", ""),
-                    # AN521_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Minsizerel", True, "", ""),
+                    # AN521_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/mps2/an521", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # AN552_GNUARM_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # AN552_GNUARM_1_RegS_RegNS_Debug_BL2
                     ("arm/mps3/an552", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # AN552_GNUARM_1_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # AN552_GNUARM_1_RegS_RegNS_Release_BL2
                     ("arm/mps3/an552", "GCC_10_3", "1",
-                     True, "OFF", "Release", True, "", ""),
-                    # MUSCA_B1_GCC_1_REG_Minsizerel_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # MUSCA_B1_GCC_1_RegS_RegNS_Minsizerel_BL2
                     ("arm/musca_b1", "GCC_10_3", "1",
-                     True, "OFF", "Minsizerel", True, "", ""),
-                    # MUSCA_S1_ARMCLANG_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Minsizerel", True, "", ""),
+                    # MUSCA_S1_ARMCLANG_2_RegS_RegNS_Release_BL2
                     ("arm/musca_s1", "ARMCLANG_6_13", "2",
-                     True, "OFF", "Release", True, "", ""),
-                    # MUSCA_S1_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # MUSCA_S1_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/musca_s1", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # MUSCA_S1_GCC_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # MUSCA_S1_GCC_2_RegS_RegNS_Release_BL2
                     ("arm/musca_s1", "GCC_10_3", "2",
-                     True, "OFF", "Release", True, "", ""),
-                    # MUSCA_S1_GCC_1_REG_Debug_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", ""),
+                    # MUSCA_S1_GCC_1_RegS_RegNS_Debug_BL2
                     ("arm/musca_s1", "GCC_10_3", "1",
-                     True, "OFF", "Debug", True, "", ""),
-                    # MUSCA_S1_GCC_1_REG_Release_BL2_CC_DRIVER_PSA
+                     "RegS, RegNS", "OFF", "Debug", True, "", ""),
+                    # MUSCA_S1_GCC_1_RegS_RegNS_Release_BL2_CC_DRIVER_PSA
                     ("arm/musca_s1", "GCC_10_3", "1",
-                     True, "OFF", "Release", True, "", "CC_DRIVER_PSA"),
+                     "RegS, RegNS", "OFF", "Release", True, "", "CC_DRIVER_PSA"),
                     # RSS_TC_GCC_2_Release_BL2_PSOFF
                     ("arm/rss/tc", "GCC_10_3", "2",
-                     False, "OFF", "Release", True, "", "PSOFF"),
-                    # stm32l562e_dk_ARMCLANG_1_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", "PSOFF"),
+                    # stm32l562e_dk_ARMCLANG_1_RegS_RegNS_Release_BL2_CRYPTO_OFF
                     ("stm/stm32l562e_dk", "ARMCLANG_6_13", "1",
-                     True, "OFF", "Release", True, "", "CRYPTO_OFF"),
-                    # stm32l562e_dk_GCC_2_REG_Release_BL2
+                     "RegS, RegNS", "OFF", "Release", True, "", "CRYPTO_OFF"),
+                    # stm32l562e_dk_GCC_2_Release_BL2_CRYPTO_ON
                     ("stm/stm32l562e_dk", "GCC_10_3", "2",
-                     False, "OFF", "Release", True, "", "CRYPTO_ON"),
-                    # stm32l562e_dk_GCC_3_REG_Release_BL2
+                     "OFF", "OFF", "Release", True, "", "CRYPTO_ON"),
+                    # stm32l562e_dk_GCC_3_RegS_RegNS_Release_BL2_CRYPTO_OFF
                     ("stm/stm32l562e_dk", "GCC_10_3", "3",
-                     True, "OFF", "Release", True, "", "CRYPTO_OFF"),
-                    # psoc64_GCC_2_REG_Release
+                     "RegS, RegNS", "OFF", "Release", True, "", "CRYPTO_OFF"),
+                    # psoc64_GCC_2_RegS_RegNS_Release
                     ("cypress/psoc64", "GCC_10_3", "2",
-                     True, "OFF", "Release", False, "", ""),
+                     "RegS, RegNS", "OFF", "Release", False, "", ""),
                 ],
                 "invalid": _common_tfm_invalid_configs + []
                 }
@@ -289,7 +289,7 @@
                                      "arm/musca_b1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -309,7 +309,7 @@
                                      "arm/musca_s1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -319,9 +319,9 @@
                 "common_params": _common_tfm_builder_cfg,
                 "valid": [
                     # sanity test for GCC v11.2
-                    # AN521_GCC_3_REG_Relwithdebinfo_BL2
+                    # AN521_GCC_3_RegS_RegNS_Relwithdebinfo_BL2
                     ("arm/mps2/an521", "GCC_11_2",
-                     "3", True, "OFF", "Relwithdebinfo",
+                     "3", "RegS, RegNS", "OFF", "Relwithdebinfo",
                      True, "", ""),
                 ],
                 "invalid": _common_tfm_invalid_configs + []
@@ -332,7 +332,7 @@
                 "tfm_platform":     ["arm/mps2/an519", "arm/mps2/an521"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -352,7 +352,7 @@
                                      "arm/musca_b1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -367,7 +367,7 @@
                 "tfm_platform":     ["arm/musca_b1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -382,7 +382,7 @@
                 "tfm_platform":     ["arm/mps2/an521"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -400,7 +400,7 @@
                                      "arm/musca_b1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -416,7 +416,7 @@
                                      "arm/musca_s1"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -432,7 +432,7 @@
                                      "arm/mps3/an552"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True],
@@ -449,7 +449,7 @@
                                      "arm/musca_s1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["IPC",
                                      "CRYPTO",
                                      "INITIAL_ATTESTATION",
@@ -467,7 +467,7 @@
                "tfm_platform":      ["arm/mps2/an521"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -482,7 +482,7 @@
                "tfm_platform":      ["arm/mps2/an521"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release", "Minsizerel"],
                 "with_bl2":         [True],
@@ -498,7 +498,7 @@
                 "tfm_platform":     ["arm/mps3/an552"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["2"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -513,7 +513,7 @@
                 "tfm_platform":     ["arm/mps3/corstone310/fvp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["2"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -528,7 +528,7 @@
                 "tfm_platform":     ["arm/mps3/corstone310/fvp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -543,7 +543,7 @@
                 "tfm_platform":     ["arm/mps3/corstone310/fvp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["2"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -588,7 +588,7 @@
                 "tfm_platform":     ["arm/mps2/an519"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True, False],
@@ -603,7 +603,7 @@
                 "tfm_platform":     ["arm/mps2/an521"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True, False],
@@ -618,7 +618,7 @@
                 "tfm_platform":     ["arm/mps3/an524"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True, False],
@@ -633,7 +633,7 @@
                 "tfm_platform":     ["arm/mps3/an547"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -648,7 +648,7 @@
                 "tfm_platform":     ["arm/mps3/an552"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True],
@@ -663,7 +663,7 @@
                 "tfm_platform":     ["arm/musca_b1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True],
@@ -678,7 +678,7 @@
                 "tfm_platform":     ["arm/musca_s1"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True],
@@ -693,7 +693,7 @@
                 "tfm_platform":     ["arm/mps3/corstone310/fvp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -708,7 +708,7 @@
                 "tfm_platform":     ["arm/rss/tc"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug", "Release"],
                 "with_bl2":         [True],
@@ -718,7 +718,7 @@
                 "common_params": _common_tfm_builder_cfg,
                 "invalid": _common_tfm_invalid_configs + [
                     # BL2 is too large for RSS in Debug builds with tests
-                    ("arm/rss/tc", "GCC_10_3", "*", True, "*",
+                    ("arm/rss/tc", "GCC_10_3", "*", "RegS, RegNS", "*",
                      "Debug", True, "*", "*"),
                 ]
                 }
@@ -727,7 +727,7 @@
                 "tfm_platform":     ["cypress/psoc64"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True],
+                "test_regression":  ["RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [False],
@@ -742,7 +742,7 @@
                 "tfm_platform":     ["arm/corstone1000"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["RegS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -757,7 +757,7 @@
                 "tfm_platform":     ["stm/stm32l562e_dk"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2", "3"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -766,14 +766,14 @@
                 },
                 "common_params": _common_tfm_builder_cfg,
                 "invalid": _common_tfm_invalid_configs + [
-                    # Oversize issue on config stm32l562e_dk_ARMCLANG_1_REG_Release_BL2
+                    # Oversize issue on config stm32l562e_dk_ARMCLANG_1_RegS_RegNS_Release_BL2
                     ("stm/stm32l562e_dk", "ARMCLANG_6_13", "1",
-                     True, "OFF", "Release", True, "", "*"),
+                     "RegS, RegNS", "OFF", "Release", True, "", "*"),
                     # all other tests are off when CRYPTO is ON
-                    ("stm/stm32l562e_dk", "*", "*", True, "*",
+                    ("stm/stm32l562e_dk", "*", "*", "RegS, RegNS", "*",
                      "*", "*", "*", "CRYPTO_ON"),
                     # all other tests are ON when CRYPTO is OFF
-                    ("stm/stm32l562e_dk", "*", "*", False, "*",
+                    ("stm/stm32l562e_dk", "*", "*", "OFF", "*",
                      "*", "*", "*", "CRYPTO_OFF"),
                 ]
                 }
@@ -782,7 +782,7 @@
                 "tfm_platform":     ["stm/b_u585i_iot02a"],
                 "compiler":         ["GCC_10_3", "ARMCLANG_6_13"],
                 "isolation_level":  ["1", "2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -797,7 +797,7 @@
                 "tfm_platform":     ["stm/nucleo_l552ze_q"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -812,7 +812,7 @@
                 "tfm_platform":     ["nxp/lpcxpresso55s69"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["2"],
-                "test_regression":  [True, False],
+                "test_regression":  ["OFF", "RegS, RegNS"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Relwithdebinfo"],
                 "with_bl2":         [False],
@@ -827,7 +827,7 @@
                 "tfm_platform":     ["lairdconnectivity/bl5340_dvk_cpuapp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -842,7 +842,7 @@
                 "tfm_platform":     ["nordic_nrf/nrf5340dk_nrf5340_cpuapp"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -857,7 +857,7 @@
                 "tfm_platform":     ["nordic_nrf/nrf9160dk_nrf9160"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -872,7 +872,7 @@
                 "tfm_platform":     ["nuvoton/m2351"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Release"],
                 "with_bl2":         [True],
@@ -887,7 +887,7 @@
                 "tfm_platform":     ["nuvoton/m2354"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -903,7 +903,7 @@
                 "tfm_platform":     ["arm/mps2/an521"],
                 "compiler":         ["GCC_10_3"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["OFF"],
                 "cmake_build_type": ["Debug"],
                 "with_bl2":         [True],
@@ -915,13 +915,13 @@
                 }
 
 config_debug_regr = deepcopy(config_debug)
-config_debug_regr["seed_params"]["test_regression"] = [True]
+config_debug_regr["seed_params"]["test_regression"] = ["RegS, RegNS"]
 
 config_debug_PSA_API = {"seed_params": {
                 "tfm_platform":     ["arm/mps2/an521"],
                 "compiler":         ["ARMCLANG_6_13"],
                 "isolation_level":  ["1"],
-                "test_regression":  [False],
+                "test_regression":  ["OFF"],
                 "test_psa_api":     ["CRYPTO",
                                      "INITIAL_ATTESTATION",
                                      "STORAGE",
diff --git a/lava_helper/lava_create_jobs.py b/lava_helper/lava_create_jobs.py
index cfee0ed..242a5d6 100755
--- a/lava_helper/lava_create_jobs.py
+++ b/lava_helper/lava_create_jobs.py
@@ -57,7 +57,7 @@
         if platform != os.getenv('TFM_PLATFORM'):
             continue
         recovery_image_url = get_recovery_url(recovery_store_url, recovery)
-        if os.getenv("TEST_REGRESSION") == "True":
+        if os.getenv("TEST_REGRESSION") != "OFF":
             monitor_name = "reg_tests"
         elif os.getenv("TEST_PSA_API") != "OFF":
             monitor_name = "arch_tests"
diff --git a/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 8e66caa..006e378 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -90,12 +90,12 @@
 
         return compiler_name
 
-    def map_extra_params(self, params):
-        extra_params = ""
+    def map_params(self, params, maps):
+        build_configs = ""
         param_list = params.split(", ")
         for param in param_list:
-            extra_params += mapExtraParams[param]
-        return extra_params
+            build_configs += maps[param]
+        return build_configs
 
     def get_config(self):
             return list(self._tbm_build_cfg.keys())
@@ -394,14 +394,14 @@
                             "tfm_platform": i.tfm_platform,
                             "compiler": self.choose_toolchain(i.compiler),
                             "isolation_level": i.isolation_level,
-                            "test_regression": i.test_regression,
+                            "test_regression": self.map_params(i.test_regression, mapRegTest),
                             "test_psa_api": i.test_psa_api,
                             "cmake_build_type": i.cmake_build_type,
                             "with_bl2": i.with_bl2,
                             "profile": "" if i.profile=="N.A" else i.profile}
         # The extra params can also contain paths with "codebase_root_dir" and
         # these also need to be substituted
-        overwrite_params["extra_params"] = self.map_extra_params(i.extra_params) % overwrite_params
+        overwrite_params["extra_params"] = self.map_params(i.extra_params, mapExtraParams) % overwrite_params
 
         if i.test_psa_api == "IPC":
             overwrite_params["test_psa_api"] += " -DINCLUDE_PANIC_TESTS=1"
@@ -409,7 +409,7 @@
             overwrite_params["test_psa_api"] += " -DCC312_LEGACY_DRIVER_API_ENABLED=OFF"
         if i.tfm_platform == "arm/musca_b1":
             overwrite_params["test_psa_api"] += " -DOTP_NV_COUNTERS_RAM_EMULATION=ON"
-        if i.test_regression:
+        if i.test_regression != "OFF":
             overwrite_params["extra_params"] += " -DTEST_BL2=False" if not i.with_bl2 else " -DTEST_BL2=True"
         build_cfg["config_template"] %= overwrite_params
         if len(build_cfg["build_cmds"]) > 1:
@@ -575,8 +575,8 @@
             config_param.append(mapPlatform[list(i)[0]])
             config_param.append(list(i)[1].split("_")[0])
             config_param.append(list(i)[2]) # ISOLATION_LEVEL
-            if list(i)[3]:  # TEST_REGRESSION
-                config_param.append("REG")
+            if list(i)[3] != "OFF":  # TEST_REGRESSION
+                config_param.append(list(i)[3].replace(", ", "_"))
             if list(i)[4] != "OFF":    #TEST_PSA_API
                 config_param.append(mapTestPsaApi[list(i)[4]])
             config_param.append(list(i)[5]) # BUILD_TYPE