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

Unified Diff: build/android/pylib/android_commands.py

Issue 25525003: Add new Android test runner command to handle linker tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 7 years, 2 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
« no previous file with comments | « no previous file | build/android/pylib/linker/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index f8aecb78e0c2c220510f4c79735c37813d119e91..eff561e80ca96593cc5410d3888a520103d27eba 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -1258,10 +1258,24 @@ class AndroidCommands(object):
self._adb.SendCommand('logcat -c')
logcat_command = 'adb %s logcat -v threadtime %s' % (self._adb._target_arg,
' '.join(filters))
- self._logcat_tmpoutfile = tempfile.TemporaryFile(bufsize=0)
+ self._logcat_tmpoutfile = tempfile.NamedTemporaryFile(bufsize=0)
self.logcat_process = subprocess.Popen(logcat_command, shell=True,
stdout=self._logcat_tmpoutfile)
+ def GetCurrentRecordedLogcat(self):
+ """Return the current content of the logcat being recorded.
+ Call this after StartRecordingLogcat() and before StopRecordingLogcat().
+ This can be useful to perform timed polling/parsing.
+ Returns:
+ Current logcat output as a single string, or None if
+ StopRecordingLogcat() was already called.
+ """
+ if not self._logcat_tmpoutfile:
+ return None
+
+ with open(self._logcat_tmpoutfile.name) as f:
+ return f.read()
+
def StopRecordingLogcat(self):
"""Stops an existing logcat recording subprocess and returns output.
@@ -1281,6 +1295,7 @@ class AndroidCommands(object):
self._logcat_tmpoutfile.seek(0)
output = self._logcat_tmpoutfile.read()
self._logcat_tmpoutfile.close()
+ self._logcat_tmpoutfile = None
return output
def SearchLogcatRecord(self, record, message, thread_id=None, proc_id=None,
« no previous file with comments | « no previous file | build/android/pylib/linker/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698