| OLD | NEW |
| 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 import copy | 5 import copy |
| 6 import fnmatch | 6 import fnmatch |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from pylib import android_commands | 10 from pylib import android_commands |
| 11 from pylib import cmd_helper | 11 from pylib import cmd_helper |
| 12 from pylib import constants | 12 from pylib import constants |
| 13 from pylib import ports | 13 from pylib import ports |
| 14 from pylib.base import shard | 14 from pylib.base import shard |
| 15 from pylib.utils import emulator | 15 from pylib.utils import emulator |
| 16 from pylib.utils import report_results |
| 16 from pylib.utils import xvfb | 17 from pylib.utils import xvfb |
| 17 | 18 |
| 18 import gtest_config | 19 import gtest_config |
| 19 import test_runner | 20 import test_runner |
| 20 | 21 |
| 21 | 22 |
| 22 def _FullyQualifiedTestSuites(exe, option_test_suite, build_type): | 23 def _FullyQualifiedTestSuites(exe, option_test_suite, build_type): |
| 23 """Get a list of absolute paths to test suite targets. | 24 """Get a list of absolute paths to test suite targets. |
| 24 | 25 |
| 25 Args: | 26 Args: |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 else: | 159 else: |
| 159 all_tests = GetAllEnabledTests(RunnerFactory, attached_devices) | 160 all_tests = GetAllEnabledTests(RunnerFactory, attached_devices) |
| 160 num_devices = len(attached_devices) | 161 num_devices = len(attached_devices) |
| 161 tests = [':'.join(all_tests[i::num_devices]) for i in xrange(num_devices)] | 162 tests = [':'.join(all_tests[i::num_devices]) for i in xrange(num_devices)] |
| 162 tests = [t for t in tests if t] | 163 tests = [t for t in tests if t] |
| 163 | 164 |
| 164 # Run tests. | 165 # Run tests. |
| 165 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, tests, | 166 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, tests, |
| 166 options.build_type) | 167 options.build_type) |
| 167 | 168 |
| 168 test_results.LogFull( | 169 report_results.LogFull( |
| 170 results=test_results, |
| 169 test_type='Unit test', | 171 test_type='Unit test', |
| 170 test_package=suite_name, | 172 test_package=suite_name, |
| 171 build_type=options.build_type, | 173 build_type=options.build_type, |
| 172 flakiness_server=options.flakiness_dashboard_server) | 174 flakiness_server=options.flakiness_dashboard_server) |
| 173 test_results.PrintAnnotation() | 175 report_results.PrintAnnotation(test_results) |
| 174 | 176 |
| 175 for buildbot_emulator in buildbot_emulators: | 177 for buildbot_emulator in buildbot_emulators: |
| 176 buildbot_emulator.Shutdown() | 178 buildbot_emulator.Shutdown() |
| 177 | 179 |
| 178 return len(test_results.GetAllBroken()) | 180 return len(test_results.GetNotPass()) |
| 179 | 181 |
| 180 | 182 |
| 181 def _ListTestSuites(): | 183 def _ListTestSuites(): |
| 182 """Display a list of available test suites.""" | 184 """Display a list of available test suites.""" |
| 183 print 'Available test suites are:' | 185 print 'Available test suites are:' |
| 184 for test_suite in gtest_config.STABLE_TEST_SUITES: | 186 for test_suite in gtest_config.STABLE_TEST_SUITES: |
| 185 print test_suite | 187 print test_suite |
| 186 | 188 |
| 187 | 189 |
| 188 def Dispatch(options): | 190 def Dispatch(options): |
| (...skipping 21 matching lines...) Expand all Loading... |
| 210 failures = 0 | 212 failures = 0 |
| 211 for suite_name, suite_path in all_test_suites: | 213 for suite_name, suite_path in all_test_suites: |
| 212 # Give each test suite its own copy of options. | 214 # Give each test suite its own copy of options. |
| 213 test_options = copy.deepcopy(options) | 215 test_options = copy.deepcopy(options) |
| 214 test_options.test_suite = suite_path | 216 test_options.test_suite = suite_path |
| 215 failures += _RunATestSuite(test_options, suite_name) | 217 failures += _RunATestSuite(test_options, suite_name) |
| 216 | 218 |
| 217 if options.use_xvfb: | 219 if options.use_xvfb: |
| 218 framebuffer.Stop() | 220 framebuffer.Stop() |
| 219 return failures | 221 return failures |
| OLD | NEW |