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

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

Issue 2451523002: Insert logcat as part of test result for android instrumentation tests. (Closed)
Patch Set: using logdog Created 4 years, 1 month 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/logcat_monitor_using_logdog.py
diff --git a/build/android/pylib/logcat_monitor_using_logdog.py b/build/android/pylib/logcat_monitor_using_logdog.py
new file mode 100644
index 0000000000000000000000000000000000000000..8f72b81780f7eaa15f5a0de6649f0a06671b7a27
--- /dev/null
+++ b/build/android/pylib/logcat_monitor_using_logdog.py
@@ -0,0 +1,34 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
jbudorick 2016/11/18 02:31:42 nit: put this in a new pylib/android directory, pl
BigBossZhiling 2016/11/22 02:54:37 Done.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import logging
+import sys
+
+CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.dirname(os.path.abspath(__file__)))))
+sys.path = ([os.path.join(CHROMIUM_SRC_DIR, 'tools', 'swarming_client')] +
jbudorick 2016/11/18 02:31:42 This shold be: from pylib import constants s
BigBossZhiling 2016/11/22 02:54:37 Done.
+ sys.path)
mikecase (-- gone --) 2016/11/05 01:27:53 Im guessing that is because you are adding this to
BigBossZhiling 2016/11/22 02:54:37 Acknowledged.
+
+from devil.android import logcat_monitor
+from libs.logdog import bootstrap
+
+class LogcatMonitorUsingLogdog(logcat_monitor.LogcatMonitor):
+ def __init__(self, adb, stream_name):
+ super(LogcatMonitorUsingLogdog, self).__init__(adb)
+ self.stream_name = stream_name
+ self.logcat_url = ''
+ def GetLogcatURL(self):
jbudorick 2016/11/18 02:31:42 Line breaks between methods + docstrings for publi
BigBossZhiling 2016/11/22 02:54:37 Done.
+ return self.logcat_url
+ def Stop(self):
jbudorick 2016/11/18 02:31:42 Can we implement this s.t. we write to the logdog
BigBossZhiling 2016/11/22 02:54:37 Done.
+ super(LogcatMonitorUsingLogdog, self).Stop()
+ try:
+ stream_client = bootstrap.ButlerBootstrap.probe().stream_client()
+ this_stream = stream_client.open_text(self.stream_name)
+ with open(self._record_file.name, 'r') as f:
+ this_stream.write(f.readline())
+ this_stream.close()
+ self.logcat_url = stream_client.get_viewer_url(self.stream_name)
+ except bootstrap.NotBootstrappedError:
+ logging.exception('Error not bootstrapped. Failed to start logdog')

Powered by Google App Engine
This is Rietveld 408576698