feat(hftest): double timeouts for coverage runs

If the FVP model is running with the test coverage plugin
configured, double the timeouts to cater for the performance
drop.

Done in both test_spmc.sh for the overall hftest.py timeout,
and inside the hftest.py for each FVP invokation.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I4615886029d56c20907f3b3c81721dd866b8dc39
diff --git a/kokoro/test_spmc.sh b/kokoro/test_spmc.sh
index f26db03..d540410 100755
--- a/kokoro/test_spmc.sh
+++ b/kokoro/test_spmc.sh
@@ -37,19 +37,6 @@
 
 }
 
-KOKORO_DIR="$(dirname "$0")"
-source $KOKORO_DIR/test_common.sh
-
-HFTEST=(${TIMEOUT[@]} 1200s ./test/hftest/hftest.py)
-
-SPMC_PATH="$OUT/secure_aem_v8a_fvp_vhe_clang"
-HYPERVISOR_PATH="$OUT/aem_v8a_fvp_vhe_clang"
-HFTEST+=(--out_partitions $OUT/secure_aem_v8a_fvp_vhe_vm_clang)
-
-HFTEST+=(--log "$LOG_DIR_BASE")
-
-HFTEST+=(--spmc "$SPMC_PATH/hafnium.bin" --driver=fvp)
-
 USE_PARITY=false
 CODE_COVERAGE=false
 
@@ -76,6 +63,25 @@
   shift
 done
 
+KOKORO_DIR="$(dirname "$0")"
+source $KOKORO_DIR/test_common.sh
+
+# Code coverage expected to slow down execution for a bit.
+HFTEST_TIMEOUT="1200s"
+if [ "$CODE_COVERAGE" = true ]; then
+	HFTEST_TIMEOUT="2400s"
+fi
+
+HFTEST=(${TIMEOUT[@]} $HFTEST_TIMEOUT ./test/hftest/hftest.py)
+
+SPMC_PATH="$OUT/secure_aem_v8a_fvp_vhe_clang"
+HYPERVISOR_PATH="$OUT/aem_v8a_fvp_vhe_clang"
+HFTEST+=(--out_partitions $OUT/secure_aem_v8a_fvp_vhe_vm_clang)
+
+HFTEST+=(--log "$LOG_DIR_BASE")
+
+HFTEST+=(--spmc "$SPMC_PATH/hafnium.bin" --driver=fvp)
+
 if [ "$CODE_COVERAGE" = true ]; then
   source $KOKORO_DIR/qa-code-coverage.sh
   FALLBACK_PLUGIN_URL="https://downloads.trustedfirmware.org/coverage-plugin/qa-tools/coverage-tool/coverage-plugin"
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index 54c51fe..85ed905 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -349,7 +349,13 @@
         """Generate command line arguments for FVP."""
         show_output = debug or show_output
         disable_visualisation = self.args.disable_visualisation is True
-        time_limit = "150s" if is_long_running else "40s"
+
+        time_limit = "40s"
+        if self.cov_plugin is None:
+            time_limit = "150s" if is_long_running else time_limit
+        else:
+            time_limit = "300s" if is_long_running else "80s"
+
         fvp_args = []
 
         if not show_output: