Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(999)

Unified Diff: build/android/pylib/remote/device/remote_device_test_run.py

Issue 1277943002: [Android] Detect when remote service loses contact with device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/remote/device/remote_device_test_run.py
diff --git a/build/android/pylib/remote/device/remote_device_test_run.py b/build/android/pylib/remote/device/remote_device_test_run.py
index 5bfbc4f7740beba8f8616ebfab0291593d9276d7..6ccfc88114620f5163a0c4310548f2c501728d43 100644
--- a/build/android/pylib/remote/device/remote_device_test_run.py
+++ b/build/android/pylib/remote/device/remote_device_test_run.py
@@ -7,6 +7,7 @@
import json
import logging
import os
+import re
import shutil
import string
import tempfile
@@ -19,6 +20,9 @@ from pylib.remote.device import appurify_sanitized
from pylib.remote.device import remote_device_helper
from pylib.utils import zip_utils
+_DEVICE_OFFLINE_RE = re.compile('error: device not found')
+
+
class RemoteDeviceTestRun(test_run.TestRun):
"""Run tests on a remote device."""
@@ -340,3 +344,18 @@ class RemoteDeviceTestRun(test_run.TestRun):
logging.log(level, line)
except KeyError:
logging.error('No logcat found.')
+
+ def _LogAdbTraceLog(self):
+ zip_file = self._DownloadTestResults(None)
+ with zipfile.ZipFile(zip_file) as z:
+ adb_trace_log = z.read('adb_trace.log')
+ for line in adb_trace_log.splitlines():
+ logging.critical(line)
+
+ def _DidDeviceGoOffline(self):
+ zip_file = self._DownloadTestResults(None)
+ with zipfile.ZipFile(zip_file) as z:
+ adb_trace_log = z.read('adb_trace.log')
+ if any(_DEVICE_OFFLINE_RE.search(l) for l in adb_trace_log.splitlines()):
+ return True
+ return False

Powered by Google App Engine
This is Rietveld 408576698