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

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: Address marcus' issues. 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') | build/android/pylib/linker/setup.py » ('J')
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..520d84b190b0fba9c35ae7061bedaee912b9280e 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -1258,10 +1258,20 @@ 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 by
frankf 2013/10/02 18:16:02 nit: first sentence on 1 line.
digit1 2013/10/03 09:16:00 Done.
+ StartRecordingLogcat(). This can be useful to perform timed
+ polling/parsing. Do not call after StopRecordingLogcat()."""
frankf 2013/10/02 18:16:02 Add Returns section in docstring and document it c
digit1 2013/10/03 09:16:00 Done.
+ 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 +1291,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') | build/android/pylib/linker/setup.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698