Enhance host side coverage measurement

Modify build configuration to include libpsa and libts code in
coverage measurement.
Change test deployments to require DebugCoverage build type of
TS libraries.
Add coverage build configs to b-test to avoid using colliding build
directories for coverage and non coverage builds.

Change-Id: Ia19fa80405f5a901527ba7b8a8364cc81d142c04
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
diff --git a/deployments/platform-inspect/platform-inspect.cmake b/deployments/platform-inspect/platform-inspect.cmake
index 9290367..b31f39f 100644
--- a/deployments/platform-inspect/platform-inspect.cmake
+++ b/deployments/platform-inspect/platform-inspect.cmake
@@ -14,6 +14,11 @@
 #  Use libpsa for locating PSA services. An appropriate version of
 #  libpsa will be imported for the environment.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBPSA_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libpsa build type" FORCE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libpsa/libpsa-import.cmake)
 target_link_libraries(platform-inspect PRIVATE libpsa::psa)
 
diff --git a/deployments/psa-api-test/psa-api-test.cmake b/deployments/psa-api-test/psa-api-test.cmake
index ba2a74e..021d431 100644
--- a/deployments/psa-api-test/psa-api-test.cmake
+++ b/deployments/psa-api-test/psa-api-test.cmake
@@ -24,6 +24,11 @@
 #  libpsa will be imported for the environment. Making sure the link order is
 #  correct.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBPSA_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libpsa build type" FORCE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libpsa/libpsa-import.cmake)
 target_link_libraries( ${PROJECT_NAME} PRIVATE libpsa::psa)
 
diff --git a/deployments/ts-demo/ts-demo.cmake b/deployments/ts-demo/ts-demo.cmake
index a7fda2c..2d39042 100644
--- a/deployments/ts-demo/ts-demo.cmake
+++ b/deployments/ts-demo/ts-demo.cmake
@@ -15,6 +15,11 @@
 #  Use libpsa for locating PSA services. An appropriate version of
 #  libpsa will be imported for the environment.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBPSA_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libpsa build type" FORCE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libpsa/libpsa-import.cmake)
 target_link_libraries(ts-demo PRIVATE libpsa::psa)
 
diff --git a/deployments/ts-remote-test/ts-remote-test.cmake b/deployments/ts-remote-test/ts-remote-test.cmake
index 0bdeb9b..ada5d1a 100644
--- a/deployments/ts-remote-test/ts-remote-test.cmake
+++ b/deployments/ts-remote-test/ts-remote-test.cmake
@@ -16,6 +16,10 @@
 #  libts will be imported for the environment in which tests are
 #  deployed.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libts/libts-import.cmake)
 target_link_libraries(ts-remote-test PRIVATE libts::ts)
 
diff --git a/deployments/ts-service-test/ts-service-test.cmake b/deployments/ts-service-test/ts-service-test.cmake
index 6c3b3fe..5437e74 100644
--- a/deployments/ts-service-test/ts-service-test.cmake
+++ b/deployments/ts-service-test/ts-service-test.cmake
@@ -16,6 +16,10 @@
 #  libts will be imported for the environment in which service tests are
 #  deployed.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libts/libts-import.cmake)
 target_link_libraries(ts-service-test PRIVATE libts::ts)
 
diff --git a/deployments/uefi-test/uefi-test.cmake b/deployments/uefi-test/uefi-test.cmake
index 9e43d6f..fda92ab 100644
--- a/deployments/uefi-test/uefi-test.cmake
+++ b/deployments/uefi-test/uefi-test.cmake
@@ -17,6 +17,10 @@
 #  libts will be imported for the enviroment in which service tests are
 #  deployed.
 #-------------------------------------------------------------------------------
+if (COVERAGE)
+	set(LIBTS_BUILD_TYPE "DEBUGCOVERAGE" CACHE STRING "Libts build type" FORCE)
+endif()
+
 include(${TS_ROOT}/deployments/libts/libts-import.cmake)
 target_link_libraries(uefi-test PRIVATE libts::ts)
 
diff --git a/tools/b-test/test_data.yaml b/tools/b-test/test_data.yaml
index d9764ed..f205307 100644
--- a/tools/b-test/test_data.yaml
+++ b/tools/b-test/test_data.yaml
@@ -40,6 +40,12 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "component-test-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/component-test/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "crypto-default-opteesp"
       src: "$TS_ROOT/deployments/crypto/config/default-opteesp"
       params:
@@ -95,11 +101,23 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "libpsa-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/libpsa/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "libsp-linux-pc"
       src: "$TS_ROOT/deployments/libsp/linux-pc"
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "libsp-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/libsp/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "libsp-opteesp"
       src: "$TS_ROOT/deployments/libsp/opteesp"
       params:
@@ -114,6 +132,12 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "libts-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/libts/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "platform-inspect-arm-linux"
       src: "$TS_ROOT/deployments/platform-inspect/arm-linux"
       os_id : "GNU/Linux"
@@ -193,6 +217,12 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "smm-gateway-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/smm-gateway/config/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "spm-test1-opteesp"
       src: "$TS_ROOT/deployments/spm-test1/opteesp"
       params:
@@ -239,6 +269,12 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "ts-service-test-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/ts-service-test/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"
     - name: "uefi-test-arm-linux"
       src: "$TS_ROOT/deployments/uefi-test/arm-linux"
       os_id : "GNU/Linux"
@@ -249,3 +285,9 @@
       os_id : "GNU/Linux"
       params:
             - "-GUnix Makefiles"
+    - name: "uefi-test-coverage-linux-pc"
+      src: "$TS_ROOT/deployments/uefi-test/linux-pc"
+      os_id : "GNU/Linux"
+      params:
+            - "-GUnix Makefiles"
+            - "-DCOVERAGE=1"