AI 143688: am: CL 143562 Usability fixes for runtest.py

Original author: brettchabot
  Merged from: //branches/cupcake/...

Automated import of CL 143688
This commit is contained in:
Brett Chabot
2009-03-31 11:14:05 -07:00
committed by The Android Open Source Project
parent db258ddbc7
commit 72731f3420
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,