Fix log syntax.

And add better error message when instrumentation test is not
present.

Change-Id: I381421e59a3b667a5c3090ccd49e38fe99d680c5
This commit is contained in:
Brett Chabot
2012-09-11 12:57:31 -07:00
parent 39e3b7fe23
commit 81c475e4ac
3 changed files with 25 additions and 28 deletions

View File

@@ -140,6 +140,7 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
logger.Log(adb_cmd)
elif options.coverage:
coverage_gen = coverage.CoverageGenerator(adb)
self._CheckInstrumentationInstalled(adb)
# need to parse test output to determine path to coverage file
logger.Log("Running in coverage mode, suppressing test output")
try:
@@ -160,12 +161,22 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
self, device_coverage_path, test_qualifier=options.test_size)
if coverage_file is not None:
logger.Log("Coverage report generated at %s" % coverage_file)
else:
adb.StartInstrumentationNoResults(
package_name=self.GetPackageName(),
runner_name=self.GetRunnerName(),
raw_mode=options.raw_mode,
instrumentation_args=instrumentation_args)
self._CheckInstrumentationInstalled(adb)
adb.StartInstrumentationNoResults(package_name=self.GetPackageName(),
runner_name=self.GetRunnerName(),
raw_mode=options.raw_mode,
instrumentation_args=
instrumentation_args)
def _CheckInstrumentationInstalled(self, adb):
if not adb.IsInstrumentationInstalled(self.GetPackageName(),
self.GetRunnerName()):
msg=("Could not find instrumentation %s/%s on device. Try forcing a "
"rebuild by updating a source file, and re-executing runtest." %
(self.GetPackageName(), self.GetRunnerName()))
raise errors.AbortError(msg=msg)
def _PrintTestResults(self, test_results):
"""Prints a summary of test result data to stdout.
@@ -189,7 +200,6 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
logger.Log("Tests run: %d, Failures: %d, Errors: %d" %
(total_count, fail_count, error_count))
def HasInstrumentationTest(path):
"""Determine if given path defines an instrumentation test.