Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py |
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
index f2a75299d0e13a3fc240e0e5098913ad3e2ddf04..fd7cfbbad34d80352cac2630712f3eeeac0e139f 100644 |
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
@@ -247,10 +247,6 @@ class LocalDeviceInstrumentationTestRun( |
# TODO(jbudorick): Make instrumentation tests output a JSON so this |
mikecase (-- gone --)
2016/04/20 22:50:31
Is the TODO outdated? Don't instrumentation tests
jbudorick
2016/04/20 22:54:37
No, this is to have the APK expose a JSON, not to
|
# doesn't have to parse the output. |
- logging.debug('output from %s:', test_display_name) |
- for l in output: |
- logging.debug(' %s', l) |
- |
result_code, result_bundle, statuses = ( |
self._test_instance.ParseAmInstrumentRawOutput(output)) |
results = self._test_instance.GenerateTestResults( |
@@ -263,8 +259,21 @@ class LocalDeviceInstrumentationTestRun( |
for r in results: |
if r.GetType() == base_test_result.ResultType.UNKNOWN: |
r.SetType(base_test_result.ResultType.CRASH) |
- # TODO(jbudorick): ClearApplicationState on failure before switching |
- # instrumentation tests to platform mode (but respect --skip-clear-data). |
+ |
+ if any(r.GetType() not in (base_test_result.ResultType.PASS, |
+ base_test_result.ResultType.SKIP) |
+ for r in results): |
+ logging.info('detected failure in %s. raw output:', test_display_name) |
+ for l in output: |
+ logging.info(' %s', l) |
+ if (not self._env.skip_clear_data |
+ and self._test_instance.package_info): |
+ device.ClearApplicationState(self._test_instance.package_info.package) |
+ else: |
+ logging.debug('raw output from %s:', test_display_name) |
+ for l in output: |
+ logging.debug(' %s', l) |
+ |
return results |
#override |