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

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

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

Powered by Google App Engine
This is Rietveld 408576698