Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import logging | |
| 6 import os | |
| 7 | |
| 8 from pylib import android_commands | |
| 9 from pylib import cmd_helper | |
| 10 from pylib import ports | |
| 11 from pylib.browsertests import test_sharder | |
| 12 | |
| 13 CONTENT_BROWSERTEST_SUITENAME = 'content_browsertests' | |
| 14 | |
| 15 def Dispatch(options): | |
| 16 attached_devices = [] | |
| 17 if options.test_device: | |
| 18 attached_devices = [options.test_device] | |
| 19 else: | |
| 20 attached_devices = android_commands.GetAttachedDevices() | |
| 21 | |
| 22 if not attached_devices: | |
| 23 logging.critical('A device must be attached and online.') | |
| 24 return 1 | |
| 25 | |
| 26 if options.gtest_filter: | |
|
craigdh
2013/02/20 23:45:30
You won't need this after merging with the new sha
| |
| 27 logging.warning('Sharding is not possible with these configurations.') | |
| 28 attached_devices = [attached_devices[0]] | |
| 29 | |
| 30 # Reset the test port allocation. It's important to do it before starting | |
| 31 # to dispatch any tests. | |
| 32 if not ports.ResetTestServerPortAllocation(): | |
| 33 raise Exception('Failed to reset test server port.') | |
| 34 | |
| 35 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(), | |
| 36 options.build_type) | |
| 37 options.test_suite = os.path.join(test_suite_dir, | |
| 38 'apks', | |
| 39 CONTENT_BROWSERTEST_SUITENAME + '.apk') | |
| 40 sharder = test_sharder.TestSharder( | |
| 41 attached_devices, | |
| 42 options.test_suite, | |
| 43 options.gtest_filter, | |
| 44 options.test_arguments, | |
| 45 options.timeout, | |
| 46 options.cleanup_test_files, | |
| 47 options.tool, | |
| 48 options.build_type, | |
| 49 options.webkit) | |
| 50 | |
| 51 test_results = sharder.RunShardedTests() | |
| 52 test_results.LogFull( | |
| 53 test_type='Unit test', | |
| 54 test_package=CONTENT_BROWSERTEST_SUITENAME, | |
| 55 build_type=options.build_type, | |
| 56 flakiness_server=options.flakiness_dashboard_server) | |
| 57 test_results.PrintAnnotation() | |
| OLD | NEW |