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
This commit is contained in:
Yuexi Ma
2017-01-25 01:11:48 -08:00
parent 05fe8ce9b4
commit a7cb8ba677
3 changed files with 28 additions and 0 deletions

View File

@@ -21,8 +21,10 @@ from vts.proto import ComponentSpecificationMessage_pb2 as CompSpecMsg
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 @@ class TvCecHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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 @@ class TvCecHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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))

View File

@@ -20,8 +20,10 @@ import logging
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 @@ class TvInputHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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 @@ class TvInputHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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)

View File

@@ -21,9 +21,11 @@ import time
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 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
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)