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

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

Issue 18086004: Move Python setup/tear down logic into Forwarder itself. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Marcus' comment Created 7 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 | Annotate | Revision Log
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 """Implements test sharding logic.""" 5 """Implements test sharding logic."""
6 6
7 import logging 7 import logging
8 import threading 8 import threading
9 9
10 from pylib import android_commands 10 from pylib import android_commands
11 from pylib import constants 11 from pylib import constants
12 from pylib import forwarder
13 from pylib.utils import reraiser_thread 12 from pylib.utils import reraiser_thread
14 from pylib.utils import watchdog_timer 13 from pylib.utils import watchdog_timer
15 14
16 import base_test_result 15 import base_test_result
17 16
18 17
19 DEFAULT_TIMEOUT = 7 * 60 # seven minutes 18 DEFAULT_TIMEOUT = 7 * 60 # seven minutes
20 19
21 20
22 class _ThreadSafeCounter(object): 21 class _ThreadSafeCounter(object):
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 num_retries: number of retries for a test. 285 num_retries: number of retries for a test.
287 286
288 Returns: 287 Returns:
289 A tuple of (base_test_result.TestRunResults object, exit code). 288 A tuple of (base_test_result.TestRunResults object, exit code).
290 """ 289 """
291 if not tests: 290 if not tests:
292 logging.error('No tests to run.') 291 logging.error('No tests to run.')
293 return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE) 292 return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE)
294 293
295 logging.info('Will run %d tests: %s', len(tests), str(tests)) 294 logging.info('Will run %d tests: %s', len(tests), str(tests))
296 forwarder.Forwarder.KillHost(build_type)
297 runners = _CreateRunners(runner_factory, devices, setup_timeout) 295 runners = _CreateRunners(runner_factory, devices, setup_timeout)
298 try: 296 try:
299 return _RunAllTests(runners, tests, num_retries, test_timeout) 297 return _RunAllTests(runners, tests, num_retries, test_timeout)
300 finally: 298 finally:
301 try: 299 try:
302 _TearDownRunners(runners, setup_timeout) 300 _TearDownRunners(runners, setup_timeout)
303 except android_commands.errors.DeviceUnresponsiveError as e: 301 except android_commands.errors.DeviceUnresponsiveError as e:
304 logging.warning('Device unresponsive during TearDown: [%s]', e) 302 logging.warning('Device unresponsive during TearDown: [%s]', e)
305 finally:
306 forwarder.Forwarder.KillHost(build_type)
OLDNEW
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/chrome_test_server_spawner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698