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

Side by Side Diff: build/android/pylib/test_result.py

Issue 11232037: Retry tests on other bots if the device is unresponsive/offline (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: small fixes Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 5
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import time 9 import time
10 import traceback 10 import traceback
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class TestResults(object): 47 class TestResults(object):
48 """Results of a test run.""" 48 """Results of a test run."""
49 49
50 def __init__(self): 50 def __init__(self):
51 self.ok = [] 51 self.ok = []
52 self.failed = [] 52 self.failed = []
53 self.crashed = [] 53 self.crashed = []
54 self.unknown = [] 54 self.unknown = []
55 self.timed_out = False 55 self.timed_out = False
56 self.overall_fail = False 56 self.overall_fail = False
57 self.device_except = False
bulach 2012/10/23 09:30:56 if you agree with the above: self.device_exceptio
57 58
58 @staticmethod 59 @staticmethod
59 def FromRun(ok=None, failed=None, crashed=None, timed_out=False, 60 def FromRun(ok=None, failed=None, crashed=None, timed_out=False,
60 overall_fail=False): 61 overall_fail=False, device_except=False):
bulach 2012/10/23 09:30:56 nit: device_exception=None
61 ret = TestResults() 62 ret = TestResults()
62 ret.ok = ok or [] 63 ret.ok = ok or []
63 ret.failed = failed or [] 64 ret.failed = failed or []
64 ret.crashed = crashed or [] 65 ret.crashed = crashed or []
65 ret.timed_out = timed_out 66 ret.timed_out = timed_out
66 ret.overall_fail = overall_fail 67 ret.overall_fail = overall_fail
68 ret.device_except = device_except
67 return ret 69 return ret
68 70
69 @staticmethod 71 @staticmethod
70 def FromTestResults(results): 72 def FromTestResults(results):
71 """Combines a list of results in a single TestResults object.""" 73 """Combines a list of results in a single TestResults object."""
72 ret = TestResults() 74 ret = TestResults()
73 for t in results: 75 for t in results:
74 ret.ok += t.ok 76 ret.ok += t.ok
75 ret.failed += t.failed 77 ret.failed += t.failed
76 ret.crashed += t.crashed 78 ret.crashed += t.crashed
77 ret.unknown += t.unknown 79 ret.unknown += t.unknown
78 if t.timed_out: 80 if t.timed_out:
79 ret.timed_out = True 81 ret.timed_out = True
80 if t.overall_fail: 82 if t.overall_fail:
81 ret.overall_fail = True 83 ret.overall_fail = True
82 return ret 84 return ret
83 85
84 @staticmethod 86 @staticmethod
87 def HasDeviceExcept(results):
88 for t in results:
89 if t.device_except:
90 return True
91
92 return False
bulach 2012/10/23 09:30:56 I think this could be: return any(filter(lambda t
yongsheng 2012/10/23 12:58:14 good.
93
94 @staticmethod
85 def FromPythonException(test_name, start_date_ms, exc_info): 95 def FromPythonException(test_name, start_date_ms, exc_info):
86 """Constructs a TestResults with exception information for the given test. 96 """Constructs a TestResults with exception information for the given test.
87 97
88 Args: 98 Args:
89 test_name: name of the test which raised an exception. 99 test_name: name of the test which raised an exception.
90 start_date_ms: the starting time for the test. 100 start_date_ms: the starting time for the test.
91 exc_info: exception info, ostensibly from sys.exc_info(). 101 exc_info: exception info, ostensibly from sys.exc_info().
92 102
93 Returns: 103 Returns:
94 A TestResults object with a SingleTestResult in the failed list. 104 A TestResults object with a SingleTestResult in the failed list.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return summary_string 194 return summary_string
185 195
186 def PrintAnnotation(self): 196 def PrintAnnotation(self):
187 """Print buildbot annotations for test results.""" 197 """Print buildbot annotations for test results."""
188 if self.timed_out: 198 if self.timed_out:
189 buildbot_report.PrintWarning() 199 buildbot_report.PrintWarning()
190 elif self.failed or self.crashed or self.overall_fail: 200 elif self.failed or self.crashed or self.overall_fail:
191 buildbot_report.PrintError() 201 buildbot_report.PrintError()
192 else: 202 else:
193 print 'Step success!' # No annotation needed 203 print 'Step success!' # No annotation needed
OLDNEW
« build/android/pylib/single_test_runner.py ('K') | « build/android/pylib/test_package_apk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698