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

Side by Side Diff: build/android/pylib/base/base_test_result.py

Issue 2664873002: Add logdog_helper script. (Closed)
Patch Set: Update one use of AddLink to SetLink I missed Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Module containing base test results classes.""" 5 """Module containing base test results classes."""
6 6
7 import threading 7 import threading
8 8
9 9
10 class ResultType(object): 10 class ResultType(object):
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 test_type: Type of the test result as defined in ResultType. 49 test_type: Type of the test result as defined in ResultType.
50 duration: Time it took for the test to run in milliseconds. 50 duration: Time it took for the test to run in milliseconds.
51 log: An optional string listing any errors. 51 log: An optional string listing any errors.
52 """ 52 """
53 assert name 53 assert name
54 assert test_type in ResultType.GetTypes() 54 assert test_type in ResultType.GetTypes()
55 self._name = name 55 self._name = name
56 self._test_type = test_type 56 self._test_type = test_type
57 self._duration = duration 57 self._duration = duration
58 self._log = log 58 self._log = log
59 self._tombstones_url = None 59 self._links = {}
60 self._logcat_url = None
61 60
62 def __str__(self): 61 def __str__(self):
63 return self._name 62 return self._name
64 63
65 def __repr__(self): 64 def __repr__(self):
66 return self._name 65 return self._name
67 66
68 def __cmp__(self, other): 67 def __cmp__(self, other):
69 # pylint: disable=W0212 68 # pylint: disable=W0212
70 return cmp(self._name, other._name) 69 return cmp(self._name, other._name)
(...skipping 27 matching lines...) Expand all
98 return self._duration 97 return self._duration
99 98
100 def SetLog(self, log): 99 def SetLog(self, log):
101 """Set the test log.""" 100 """Set the test log."""
102 self._log = log 101 self._log = log
103 102
104 def GetLog(self): 103 def GetLog(self):
105 """Get the test log.""" 104 """Get the test log."""
106 return self._log 105 return self._log
107 106
108 def SetTombstonesUrl(self, tombstones_url): 107 def SetLink(self, name, link_url):
109 self._tombstones_url = tombstones_url 108 """Set link with test result data."""
109 self._links[name] = link_url
110 110
111 def GetTombstonesUrl(self): 111 def GetLinks(self):
112 return self._tombstones_url 112 """Get dict containing links to test result data."""
113 return self._links
113 114
114 def SetLogcatUrl(self, logcat_url):
115 self._logcat_url = logcat_url
116
117 def GetLogcatUrl(self):
118 return self._logcat_url
119 115
120 class TestRunResults(object): 116 class TestRunResults(object):
121 """Set of results for a test run.""" 117 """Set of results for a test run."""
122 118
123 def __init__(self): 119 def __init__(self):
120 self._links = {}
124 self._results = set() 121 self._results = set()
125 self._results_lock = threading.RLock() 122 self._results_lock = threading.RLock()
126 123
124 def SetLink(self, name, link_url):
125 """Add link with test run results data."""
126 self._links[name] = link_url
127
128 def GetLinks(self):
129 """Get dict containing links to test run result data."""
130 return self._links
131
127 def GetLogs(self): 132 def GetLogs(self):
128 """Get the string representation of all test logs.""" 133 """Get the string representation of all test logs."""
129 with self._results_lock: 134 with self._results_lock:
130 s = [] 135 s = []
131 for test_type in ResultType.GetTypes(): 136 for test_type in ResultType.GetTypes():
132 if test_type != ResultType.PASS: 137 if test_type != ResultType.PASS:
133 for t in sorted(self._GetType(test_type)): 138 for t in sorted(self._GetType(test_type)):
134 log = t.GetLog() 139 log = t.GetLog()
135 if log: 140 if log:
136 s.append('[%s] %s:' % (test_type, t)) 141 s.append('[%s] %s:' % (test_type, t))
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return self._GetType(ResultType.UNKNOWN) 254 return self._GetType(ResultType.UNKNOWN)
250 255
251 def GetNotPass(self): 256 def GetNotPass(self):
252 """Get the set of all non-passed test results.""" 257 """Get the set of all non-passed test results."""
253 return self.GetAll() - self.GetPass() 258 return self.GetAll() - self.GetPass()
254 259
255 def DidRunPass(self): 260 def DidRunPass(self):
256 """Return whether the test run was successful.""" 261 """Return whether the test run was successful."""
257 return not self.GetNotPass() - self.GetSkip() 262 return not self.GetNotPass() - self.GetSkip()
258 263
OLDNEW
« no previous file with comments | « build/android/pylib/android/logdog_logcat_monitor.py ('k') | build/android/pylib/local/device/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698