AI 143713: am: CL 143688 am: CL 143562 Usability fixes for runtest.py
Original author: brettchabot
Merged from: //branches/cupcake/...
Original author: android-build
Merged from: //branches/donutburger/...
Automated import of CL 143713
diff --git a/testrunner/coverage.py b/testrunner/coverage.py
index 507c5c7..39a2ceb 100755
--- a/testrunner/coverage.py
+++ b/testrunner/coverage.py
@@ -70,6 +70,27 @@
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,