AI 143562: Usability fixes for runtest.py

BUG=1743678

Automated import of CL 143562
This commit is contained in:
Brett Chabot
2009-03-30 17:00:24 -07:00
committed by The Android Open Source Project
parent 9738144670
commit f7dd570dec
4 changed files with 66 additions and 11 deletions

View File

@@ -70,6 +70,27 @@ class CoverageGenerator(object):
def EnableCoverageBuild(self):
"""Enable building an Android target with code coverage instrumentation."""
os.environ[self._EMMA_BUILD_FLAG] = "true"
#TODO: can emma.jar automagically be added to bootclasspath here?
def TestDeviceCoverageSupport(self):
"""Check if device has support for generating code coverage metrics.
Currently this will check if the emma.jar file is on the device's boot
classpath.
Returns:
True if device can support code coverage. False otherwise.
"""
output = self._adb.SendShellCommand("cat init.rc | grep BOOTCLASSPATH | "
"grep emma.jar")
if len(output) > 0:
return True
else:
logger.Log("Error: Targeted device does not have emma.jar on its "
"BOOTCLASSPATH.")
logger.Log("Modify the BOOTCLASSPATH entry in system/core/rootdir/init.rc"
" to add emma.jar")
return False
def ExtractReport(self, test_suite,
device_coverage_path=_DEVICE_COVERAGE_PATH,