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

Side by Side Diff: build/android/run_tests.py

Issue 11794039: [Android] Remove fast_and_loose option from the gtest runner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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
« no previous file with comments | « build/android/pylib/utils/test_options_parser.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all the native unit tests. 7 """Runs all the native unit tests.
8 8
9 1. Copy over test binary to /data/local on device. 9 1. Copy over test binary to /data/local on device.
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 'Ensure it has been built.\n' % 105 'Ensure it has been built.\n' %
106 (t, q, _TEST_SUITES)) 106 (t, q, _TEST_SUITES))
107 return qualified_test_suites 107 return qualified_test_suites
108 108
109 109
110 class TestSharder(BaseTestSharder): 110 class TestSharder(BaseTestSharder):
111 """Responsible for sharding the tests on the connected devices.""" 111 """Responsible for sharding the tests on the connected devices."""
112 112
113 def __init__(self, attached_devices, test_suite, gtest_filter, 113 def __init__(self, attached_devices, test_suite, gtest_filter,
114 test_arguments, timeout, cleanup_test_files, tool, 114 test_arguments, timeout, cleanup_test_files, tool,
115 log_dump_name, fast_and_loose, build_type, in_webkit_checkout, 115 log_dump_name, build_type, in_webkit_checkout,
116 flakiness_server=None): 116 flakiness_server=None):
117 BaseTestSharder.__init__(self, attached_devices, build_type) 117 BaseTestSharder.__init__(self, attached_devices, build_type)
118 self.test_suite = test_suite 118 self.test_suite = test_suite
119 self.gtest_filter = gtest_filter or '' 119 self.gtest_filter = gtest_filter or ''
120 self.test_arguments = test_arguments 120 self.test_arguments = test_arguments
121 self.timeout = timeout 121 self.timeout = timeout
122 self.cleanup_test_files = cleanup_test_files 122 self.cleanup_test_files = cleanup_test_files
123 self.tool = tool 123 self.tool = tool
124 self.log_dump_name = log_dump_name 124 self.log_dump_name = log_dump_name
125 self.fast_and_loose = fast_and_loose
126 self.in_webkit_checkout = in_webkit_checkout 125 self.in_webkit_checkout = in_webkit_checkout
127 self.flakiness_server = flakiness_server 126 self.flakiness_server = flakiness_server
128 self.all_tests = [] 127 self.all_tests = []
129 if not self.gtest_filter: 128 if not self.gtest_filter:
130 # No filter has been specified, let's add all tests then. 129 # No filter has been specified, let's add all tests then.
131 self.all_tests, self.attached_devices = self._GetAllEnabledTests() 130 self.all_tests, self.attached_devices = self._GetAllEnabledTests()
132 self.tests = self.all_tests 131 self.tests = self.all_tests
133 132
134 def _GetAllEnabledTests(self): 133 def _GetAllEnabledTests(self):
135 """Get all enabled tests and available devices. 134 """Get all enabled tests and available devices.
(...skipping 26 matching lines...) Expand all
162 test_runner = SingleTestRunner( 161 test_runner = SingleTestRunner(
163 device, 162 device,
164 self.test_suite, 163 self.test_suite,
165 self.gtest_filter, 164 self.gtest_filter,
166 self.test_arguments, 165 self.test_arguments,
167 self.timeout, 166 self.timeout,
168 self.cleanup_test_files, 167 self.cleanup_test_files,
169 self.tool, 168 self.tool,
170 0, 169 0,
171 not not self.log_dump_name, 170 not not self.log_dump_name,
172 self.fast_and_loose,
173 self.build_type, 171 self.build_type,
174 self.in_webkit_checkout) 172 self.in_webkit_checkout)
175 # The executable/apk needs to be copied before we can call GetAllTests. 173 # The executable/apk needs to be copied before we can call GetAllTests.
176 test_runner.test_package.StripAndCopyExecutable() 174 test_runner.test_package.StripAndCopyExecutable()
177 all_tests = test_runner.test_package.GetAllTests() 175 all_tests = test_runner.test_package.GetAllTests()
178 disabled_list = test_runner.GetDisabledTests() 176 disabled_list = test_runner.GetDisabledTests()
179 # Only includes tests that do not have any match in the disabled list. 177 # Only includes tests that do not have any match in the disabled list.
180 all_tests = filter(lambda t: 178 all_tests = filter(lambda t:
181 not any([fnmatch.fnmatch(t, disabled_pattern) 179 not any([fnmatch.fnmatch(t, disabled_pattern)
182 for disabled_pattern in disabled_list]), 180 for disabled_pattern in disabled_list]),
(...skipping 15 matching lines...) Expand all
198 shard_test_list = self.tests[index * shard_size : (index + 1) * shard_size] 196 shard_test_list = self.tests[index * shard_size : (index + 1) * shard_size]
199 test_filter = ':'.join(shard_test_list) + self.gtest_filter 197 test_filter = ':'.join(shard_test_list) + self.gtest_filter
200 return SingleTestRunner( 198 return SingleTestRunner(
201 device, 199 device,
202 self.test_suite, 200 self.test_suite,
203 test_filter, 201 test_filter,
204 self.test_arguments, 202 self.test_arguments,
205 self.timeout, 203 self.timeout,
206 self.cleanup_test_files, self.tool, index, 204 self.cleanup_test_files, self.tool, index,
207 not not self.log_dump_name, 205 not not self.log_dump_name,
208 self.fast_and_loose,
209 self.build_type, 206 self.build_type,
210 self.in_webkit_checkout) 207 self.in_webkit_checkout)
211 208
212 def OnTestsCompleted(self, test_runners, test_results): 209 def OnTestsCompleted(self, test_runners, test_results):
213 """Notifies that we completed the tests.""" 210 """Notifies that we completed the tests."""
214 test_results.LogFull( 211 test_results.LogFull(
215 test_type='Unit test', 212 test_type='Unit test',
216 test_package=test_runners[0].test_package.test_suite_basename, 213 test_package=test_runners[0].test_package.test_suite_basename,
217 build_type=self.build_type, 214 build_type=self.build_type,
218 all_tests=self.all_tests, 215 all_tests=self.all_tests,
(...skipping 27 matching lines...) Expand all
246 attached_devices = [] 243 attached_devices = []
247 buildbot_emulators = [] 244 buildbot_emulators = []
248 245
249 if options.use_emulator: 246 if options.use_emulator:
250 for n in range(options.emulator_count): 247 for n in range(options.emulator_count):
251 t = time_profile.TimeProfile('Emulator launch %d' % n) 248 t = time_profile.TimeProfile('Emulator launch %d' % n)
252 avd_name = None 249 avd_name = None
253 if n > 0: 250 if n > 0:
254 # Creates a temporary AVD for the extra emulators. 251 # Creates a temporary AVD for the extra emulators.
255 avd_name = 'run_tests_avd_%d' % n 252 avd_name = 'run_tests_avd_%d' % n
256 buildbot_emulator = emulator.Emulator(avd_name, options.fast_and_loose) 253 buildbot_emulator = emulator.Emulator(avd_name)
257 buildbot_emulator.Launch(kill_all_emulators=n == 0) 254 buildbot_emulator.Launch(kill_all_emulators=n == 0)
258 t.Stop() 255 t.Stop()
259 buildbot_emulators.append(buildbot_emulator) 256 buildbot_emulators.append(buildbot_emulator)
260 attached_devices.append(buildbot_emulator.device) 257 attached_devices.append(buildbot_emulator.device)
261 # Wait for all emulators to boot completed. 258 # Wait for all emulators to boot completed.
262 map(lambda buildbot_emulator: buildbot_emulator.ConfirmLaunch(True), 259 map(lambda buildbot_emulator: buildbot_emulator.ConfirmLaunch(True),
263 buildbot_emulators) 260 buildbot_emulators)
264 elif options.test_device: 261 elif options.test_device:
265 attached_devices = [options.test_device] 262 attached_devices = [options.test_device]
266 else: 263 else:
(...skipping 15 matching lines...) Expand all
282 279
283 sharder = TestSharder( 280 sharder = TestSharder(
284 attached_devices, 281 attached_devices,
285 options.test_suite, 282 options.test_suite,
286 options.gtest_filter, 283 options.gtest_filter,
287 options.test_arguments, 284 options.test_arguments,
288 options.timeout, 285 options.timeout,
289 options.cleanup_test_files, 286 options.cleanup_test_files,
290 options.tool, 287 options.tool,
291 options.log_dump, 288 options.log_dump,
292 options.fast_and_loose,
293 options.build_type, 289 options.build_type,
294 options.webkit, 290 options.webkit,
295 options.flakiness_dashboard_server) 291 options.flakiness_dashboard_server)
296 test_results = sharder.RunShardedTests() 292 test_results = sharder.RunShardedTests()
297 293
298 for buildbot_emulator in buildbot_emulators: 294 for buildbot_emulator in buildbot_emulators:
299 buildbot_emulator.Shutdown() 295 buildbot_emulator.Shutdown()
300 296
301 return len(test_results.failed) 297 return len(test_results.failed)
302 298
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 # the batch (this happens because the exit status is a sum of all failures 363 # the batch (this happens because the exit status is a sum of all failures
368 # from all suites, but the buildbot associates the exit status only with the 364 # from all suites, but the buildbot associates the exit status only with the
369 # most recent step). 365 # most recent step).
370 if options.exit_code: 366 if options.exit_code:
371 return failed_tests_count 367 return failed_tests_count
372 return 0 368 return 0
373 369
374 370
375 if __name__ == '__main__': 371 if __name__ == '__main__':
376 sys.exit(main(sys.argv)) 372 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/pylib/utils/test_options_parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698