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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 # 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.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os
6 import logging
7 import sys
8
9 CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
10 os.path.dirname(os.path.abspath(__file__)))))
11 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.
12 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.
13
14 from devil.android import logcat_monitor
15 from libs.logdog import bootstrap
16
17 class LogcatMonitorUsingLogdog(logcat_monitor.LogcatMonitor):
18 def __init__(self, adb, stream_name):
19 super(LogcatMonitorUsingLogdog, self).__init__(adb)
20 self.stream_name = stream_name
21 self.logcat_url = ''
22 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.
23 return self.logcat_url
24 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.
25 super(LogcatMonitorUsingLogdog, self).Stop()
26 try:
27 stream_client = bootstrap.ButlerBootstrap.probe().stream_client()
28 this_stream = stream_client.open_text(self.stream_name)
29 with open(self._record_file.name, 'r') as f:
30 this_stream.write(f.readline())
31 this_stream.close()
32 self.logcat_url = stream_client.get_viewer_url(self.stream_name)
33 except bootstrap.NotBootstrappedError:
34 logging.exception('Error not bootstrapped. Failed to start logdog')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698