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

Side by Side Diff: build/android/pylib/local/device/local_device_test_run.py

Issue 2099323002: [Android] Prepare the test runner for @RetryOnFailure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « build/android/pylib/local/device/local_device_instrumentation_test_run.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import fnmatch 5 import fnmatch
6 import functools 6 import functools
7 import imp 7 import imp
8 import logging 8 import logging
9 import signal 9 import signal
10 import thread 10 import thread
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) 153 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries)
154 if tests: 154 if tests:
155 logging.info('%d failed tests remain.', len(tests)) 155 logging.info('%d failed tests remain.', len(tests))
156 else: 156 else:
157 logging.info('All tests completed.') 157 logging.info('All tests completed.')
158 158
159 return results 159 return results
160 160
161 def _GetTestsToRetry(self, tests, try_results): 161 def _GetTestsToRetry(self, tests, try_results):
162 162
163 def is_failure(test_result): 163 def is_failure_result(test_result):
164 return ( 164 return (
165 test_result is None 165 test_result is None
166 or test_result.GetType() not in ( 166 or test_result.GetType() not in (
167 base_test_result.ResultType.PASS, 167 base_test_result.ResultType.PASS,
168 base_test_result.ResultType.SKIP)) 168 base_test_result.ResultType.SKIP))
169 169
170 all_test_results = {r.GetName(): r for r in try_results.GetAll()} 170 all_test_results = {r.GetName(): r for r in try_results.GetAll()}
171 171
172 def should_retry(name): 172 def test_failed(name):
173 # When specifying a test filter, names can contain trailing wildcards. 173 # When specifying a test filter, names can contain trailing wildcards.
174 # See local_device_gtest_run._ExtractTestsFromFilter() 174 # See local_device_gtest_run._ExtractTestsFromFilter()
175 if name.endswith('*'): 175 if name.endswith('*'):
mikecase (-- gone --) 2016/07/01 19:00:37 I dont think I understand this. I get that a * can
jbudorick 2016/07/11 16:32:51 Yeah, this is a bit complicated because of an opti
176 return any(fnmatch.fnmatch(n, name) and is_failure(t) 176 return any(fnmatch.fnmatch(n, name) and is_failure_result(t)
177 for n, t in all_test_results.iteritems()) 177 for n, t in all_test_results.iteritems())
178 return is_failure(all_test_results.get(name)) 178 return is_failure_result(all_test_results.get(name))
179 179
180 return [t for t in tests if should_retry(self._GetUniqueTestName(t))] 180 failed_tests = (t for t in tests if test_failed(self._GetUniqueTestName(t)))
181
182 return [t for t in failed_tests if self._ShouldRetry(t)]
181 183
182 def GetTool(self, device): 184 def GetTool(self, device):
183 if not str(device) in self._tools: 185 if not str(device) in self._tools:
184 self._tools[str(device)] = valgrind_tools.CreateTool( 186 self._tools[str(device)] = valgrind_tools.CreateTool(
185 self._env.tool, device) 187 self._env.tool, device)
186 return self._tools[str(device)] 188 return self._tools[str(device)]
187 189
188 def _CreateShards(self, tests): 190 def _CreateShards(self, tests):
189 raise NotImplementedError 191 raise NotImplementedError
190 192
191 # pylint: disable=no-self-use
192 def _GetUniqueTestName(self, test): 193 def _GetUniqueTestName(self, test):
194 # pylint: disable=no-self-use
193 return test 195 return test
194 196
197 def _ShouldRetry(self, test):
198 # pylint: disable=no-self-use,unused-argument
199 return True
200
195 def _GetTests(self): 201 def _GetTests(self):
196 raise NotImplementedError 202 raise NotImplementedError
197 203
198 def _RunTest(self, device, test): 204 def _RunTest(self, device, test):
199 raise NotImplementedError 205 raise NotImplementedError
200 206
201 def _ShouldShard(self): 207 def _ShouldShard(self):
202 raise NotImplementedError 208 raise NotImplementedError
OLDNEW
« no previous file with comments | « build/android/pylib/local/device/local_device_instrumentation_test_run.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698