Add coverage to tv_input, tv_cec, and vehicle vts hal tests
Bug: 34671241
Test: ENABLE_TREBLE=true make vts BUILD_GOOGLE_VTS=true -j32 && vts-tradefed run commandAndExit vts --skip-all-system-status-check --skip-preconditions --module TvInputHidlTest -l INFO
Change-Id: Id470d57b15d68fdb9518f565384501887de78826
diff --git a/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py b/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
index 5f7aaf1..7cb1b06 100644
--- a/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
+++ b/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
@@ -21,8 +21,10 @@
from vts.runners.host import asserts
from vts.runners.host import base_test_with_webdb
from vts.runners.host import const
+from vts.runners.host import keys
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
+from vts.utils.python.coverage import coverage_utils
class TvCecHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
@@ -38,6 +40,9 @@
self.dut.shell.one.Execute(
"setprop vts.hal.vts.hidl.get_stub true")
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ coverage_utils.InitializeDeviceCoverage(self.dut)
+
self.dut.hal.InitHidlHal(
target_type="tv_cec",
target_basepaths=self.dut.libPaths,
@@ -47,6 +52,11 @@
hw_binder_service_name="cec-hal-1-0",
bits=64 if self.dut.is64Bit else 32)
+ def tearDownClass(self):
+ """To be executed when all test cases are finished."""
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ self.SetCoverageData(coverage_utils.GetGcdaDict(self.dut))
+
def testGetCecVersion1(self):
"""A simple test case which queries the cec version."""
logging.info('DIR HAL %s', dir(self.dut.hal))
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
index b5becd6..828b9dd 100644
--- a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
@@ -20,8 +20,10 @@
from vts.runners.host import asserts
from vts.runners.host import base_test_with_webdb
from vts.runners.host import const
+from vts.runners.host import keys
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
+from vts.utils.python.coverage import coverage_utils
class TvInputHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
@@ -34,6 +36,9 @@
self.dut.shell.InvokeTerminal("one")
self.dut.shell.one.Execute("setenforce 0") # SELinux permissive mode
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ coverage_utils.InitializeDeviceCoverage(self.dut)
+
self.dut.hal.InitHidlHal(target_type="tv_input",
target_basepaths=["/system/lib64"],
target_version=1.0,
@@ -43,6 +48,11 @@
self.dut.shell.InvokeTerminal("one")
+ def tearDownClass(self):
+ """To be executed when all test cases are finished."""
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ self.SetCoverageData(coverage_utils.GetGcdaDict(self.dut))
+
def testGetStreamConfigurations(self):
configs = self.dut.hal.tv_input.getStreamConfigurations(0)
logging.info('return value of getStreamConfigurations(0): %s', configs)
diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
index cd52abf..a94c47a 100644
--- a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
+++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
@@ -21,9 +21,11 @@
from vts.runners.host import asserts
from vts.runners.host import base_test_with_webdb
from vts.runners.host import const
+from vts.runners.host import keys
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
from vts.utils.python.profiling import profiling_utils
+from vts.utils.python.coverage import coverage_utils
class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
@@ -40,6 +42,9 @@
system_uid = results[const.STDOUT][0].strip()
logging.info("system_uid: %s", system_uid)
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ coverage_utils.InitializeDeviceCoverage(self.dut)
+
self.dut.hal.InitHidlHal(
target_type="vehicle",
target_basepaths=self.dut.libPaths,
@@ -63,6 +68,9 @@
if self.enable_profiling:
self.ProcessAndUploadTraceData()
+ if getattr(self, keys.ConfigKeys.IKEY_ENABLE_COVERAGE, False):
+ self.SetCoverageData(coverage_utils.GetGcdaDict(self.dut))
+
def setUpTest(self):
if self.enable_profiling:
profiling_utils.EnableVTSProfiling(self.dut.shell.one)