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

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

Issue 1376483002: [Android] Add --repeat for gtests and instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | build/android/pylib/results/json_results.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 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 """Dispatches tests, either sharding or replicating them. 5 """Dispatches tests, either sharding or replicating them.
6 6
7 Performs the following steps: 7 Performs the following steps:
8 * Create a test collection factory, using the given tests 8 * Create a test collection factory, using the given tests
9 - If sharding: test collection factory returns the same shared test collection 9 - If sharding: test collection factory returns the same shared test collection
10 to all test runners 10 to all test runners
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 num_retries: Number of retries for a test. 164 num_retries: Number of retries for a test.
165 timeout: Watchdog timeout in seconds. 165 timeout: Watchdog timeout in seconds.
166 tag_results_with_device: If True, appends the name of the device on which 166 tag_results_with_device: If True, appends the name of the device on which
167 the test was run to the test name. Used when replicating to identify 167 the test was run to the test name. Used when replicating to identify
168 which device ran each copy of the test, and to ensure each copy of the 168 which device ran each copy of the test, and to ensure each copy of the
169 test is recorded separately. 169 test is recorded separately.
170 170
171 Returns: 171 Returns:
172 A tuple of (TestRunResults object, exit code) 172 A tuple of (TestRunResults object, exit code)
173 """ 173 """
174 logging.warning('Running tests with %s test runners.', len(runners)) 174 logging.warning('Running tests with %s test %s.',
175 len(runners), 'runners' if len(runners) != 1 else 'runner')
175 results = [] 176 results = []
176 exit_code = 0 177 exit_code = 0
177 run_results = base_test_result.TestRunResults() 178 run_results = base_test_result.TestRunResults()
178 watcher = watchdog_timer.WatchdogTimer(timeout) 179 watcher = watchdog_timer.WatchdogTimer(timeout)
179 test_collections = [test_collection_factory() for _ in runners] 180 test_collections = [test_collection_factory() for _ in runners]
180 181
181 threads = [ 182 threads = [
182 reraiser_thread.ReraiserThread( 183 reraiser_thread.ReraiserThread(
183 _RunTestsFromQueue, 184 _RunTestsFromQueue,
184 [r, tc, results, watcher, num_retries, tag_results_with_device], 185 [r, tc, results, watcher, num_retries, tag_results_with_device],
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 Args: 221 Args:
221 runner_factory: Callable that takes a device and index and returns a 222 runner_factory: Callable that takes a device and index and returns a
222 TestRunner object. 223 TestRunner object.
223 devices: List of device serial numbers as strings. 224 devices: List of device serial numbers as strings.
224 timeout: Watchdog timeout in seconds, defaults to the default timeout. 225 timeout: Watchdog timeout in seconds, defaults to the default timeout.
225 226
226 Returns: 227 Returns:
227 A list of TestRunner objects. 228 A list of TestRunner objects.
228 """ 229 """
229 logging.warning('Creating %s test runners.', len(devices)) 230 logging.warning('Creating %s test %s.', len(devices),
231 'runners' if len(devices) != 1 else 'runner')
230 runners = [] 232 runners = []
231 counter = _ThreadSafeCounter() 233 counter = _ThreadSafeCounter()
232 threads = reraiser_thread.ReraiserThreadGroup( 234 threads = reraiser_thread.ReraiserThreadGroup(
233 [reraiser_thread.ReraiserThread(_SetUp, 235 [reraiser_thread.ReraiserThread(_SetUp,
234 [runner_factory, d, runners, counter], 236 [runner_factory, d, runners, counter],
235 name=str(d)[-4:]) 237 name=str(d)[-4:])
236 for d in devices]) 238 for d in devices])
237 threads.StartAll() 239 threads.StartAll()
238 threads.JoinAll(watchdog_timer.WatchdogTimer(timeout)) 240 threads.JoinAll(watchdog_timer.WatchdogTimer(timeout))
239 return runners 241 return runners
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 try: 328 try:
327 return _RunAllTests(runners, test_collection_factory, 329 return _RunAllTests(runners, test_collection_factory,
328 num_retries, test_timeout, tag_results_with_device) 330 num_retries, test_timeout, tag_results_with_device)
329 finally: 331 finally:
330 try: 332 try:
331 _TearDownRunners(runners, setup_timeout) 333 _TearDownRunners(runners, setup_timeout)
332 except device_errors.DeviceUnreachableError as e: 334 except device_errors.DeviceUnreachableError as e:
333 logging.warning('Device unresponsive during TearDown: [%s]', e) 335 logging.warning('Device unresponsive during TearDown: [%s]', e)
334 except Exception: # pylint: disable=broad-except 336 except Exception: # pylint: disable=broad-except
335 logging.exception('Unexpected exception caught during TearDown') 337 logging.exception('Unexpected exception caught during TearDown')
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/results/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698