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

Side by Side Diff: build/android/pylib/gtest/dispatch.py

Issue 15942016: Creates a new test running script test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts flakiness server change, uses os.path.join 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
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 """Dispatches GTests."""
6
5 import copy 7 import copy
6 import fnmatch 8 import fnmatch
7 import logging 9 import logging
8 import os 10 import os
9 11
10 from pylib import android_commands 12 from pylib import android_commands
11 from pylib import cmd_helper 13 from pylib import cmd_helper
12 from pylib import constants 14 from pylib import constants
13 from pylib import ports 15 from pylib import ports
14 from pylib.base import shard 16 from pylib.base import shard
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 'Ensure it has been built.\n' % 60 'Ensure it has been built.\n' %
59 (t, q, gtest_config.STABLE_TEST_SUITES)) 61 (t, q, gtest_config.STABLE_TEST_SUITES))
60 return qualified_test_suites 62 return qualified_test_suites
61 63
62 64
63 def GetTestsFromDevice(runner): 65 def GetTestsFromDevice(runner):
64 """Get a list of tests from a device, excluding disabled tests. 66 """Get a list of tests from a device, excluding disabled tests.
65 67
66 Args: 68 Args:
67 runner: a TestRunner. 69 runner: a TestRunner.
70 Returns:
71 All non-disabled tests on the device.
68 """ 72 """
69 # The executable/apk needs to be copied before we can call GetAllTests. 73 # The executable/apk needs to be copied before we can call GetAllTests.
70 runner.test_package.StripAndCopyExecutable() 74 runner.test_package.StripAndCopyExecutable()
71 all_tests = runner.test_package.GetAllTests() 75 all_tests = runner.test_package.GetAllTests()
72 # Only includes tests that do not have any match in the disabled list. 76 # Only includes tests that do not have any match in the disabled list.
73 disabled_list = runner.GetDisabledTests() 77 disabled_list = runner.GetDisabledTests()
74 return filter(lambda t: not any([fnmatch.fnmatch(t, disabled_pattern) 78 return filter(lambda t: not any([fnmatch.fnmatch(t, disabled_pattern)
75 for disabled_pattern in disabled_list]), 79 for disabled_pattern in disabled_list]),
76 all_tests) 80 all_tests)
77 81
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 options.cleanup_test_files, 152 options.cleanup_test_files,
149 options.tool, 153 options.tool,
150 options.build_type, 154 options.build_type,
151 options.webkit, 155 options.webkit,
152 options.push_deps, 156 options.push_deps,
153 constants.GTEST_TEST_PACKAGE_NAME, 157 constants.GTEST_TEST_PACKAGE_NAME,
154 constants.GTEST_TEST_ACTIVITY_NAME, 158 constants.GTEST_TEST_ACTIVITY_NAME,
155 constants.GTEST_COMMAND_LINE_FILE) 159 constants.GTEST_COMMAND_LINE_FILE)
156 160
157 # Get tests and split them up based on the number of devices. 161 # Get tests and split them up based on the number of devices.
158 if options.gtest_filter: 162 if options.test_filter:
159 all_tests = [t for t in options.gtest_filter.split(':') if t] 163 all_tests = [t for t in options.test_filter.split(':') if t]
160 else: 164 else:
161 all_tests = GetAllEnabledTests(RunnerFactory, attached_devices) 165 all_tests = GetAllEnabledTests(RunnerFactory, attached_devices)
162 num_devices = len(attached_devices) 166 num_devices = len(attached_devices)
163 tests = [':'.join(all_tests[i::num_devices]) for i in xrange(num_devices)] 167 tests = [':'.join(all_tests[i::num_devices]) for i in xrange(num_devices)]
164 tests = [t for t in tests if t] 168 tests = [t for t in tests if t]
165 169
166 # Run tests. 170 # Run tests.
167 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, tests, 171 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, tests,
168 options.build_type, test_timeout=None, 172 options.build_type, test_timeout=None,
169 num_retries=options.num_retries) 173 num_retries=options.num_retries)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 """ 207 """
204 if options.test_suite == 'help': 208 if options.test_suite == 'help':
205 _ListTestSuites() 209 _ListTestSuites()
206 return 0 210 return 0
207 211
208 if options.use_xvfb: 212 if options.use_xvfb:
209 framebuffer = xvfb.Xvfb() 213 framebuffer = xvfb.Xvfb()
210 framebuffer.Start() 214 framebuffer.Start()
211 215
212 all_test_suites = _FullyQualifiedTestSuites(options.exe, options.test_suite, 216 all_test_suites = _FullyQualifiedTestSuites(options.exe, options.test_suite,
213 options.build_type) 217 options.build_type)
214 failures = 0 218 failures = 0
215 for suite_name, suite_path in all_test_suites: 219 for suite_name, suite_path in all_test_suites:
216 # Give each test suite its own copy of options. 220 # Give each test suite its own copy of options.
217 test_options = copy.deepcopy(options) 221 test_options = copy.deepcopy(options)
218 test_options.test_suite = suite_path 222 test_options.test_suite = suite_path
219 failures += _RunATestSuite(test_options, suite_name) 223 failures += _RunATestSuite(test_options, suite_name)
220 224
221 if options.use_xvfb: 225 if options.use_xvfb:
222 framebuffer.Stop() 226 framebuffer.Stop()
223 return failures 227 return failures
OLDNEW
« no previous file with comments | « build/android/pylib/browsertests/dispatch.py ('k') | build/android/pylib/gtest/test_package_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698