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

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

Issue 11616010: Refactor android test results logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all comments Created 8 years 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/run_monkey_test.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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 pass 167 pass
168 del os.environ['DISPLAY'] 168 del os.environ['DISPLAY']
169 self._pid = 0 169 self._pid = 0
170 170
171 171
172 class TestSharder(BaseTestSharder): 172 class TestSharder(BaseTestSharder):
173 """Responsible for sharding the tests on the connected devices.""" 173 """Responsible for sharding the tests on the connected devices."""
174 174
175 def __init__(self, attached_devices, test_suite, gtest_filter, 175 def __init__(self, attached_devices, test_suite, gtest_filter,
176 test_arguments, timeout, cleanup_test_files, tool, 176 test_arguments, timeout, cleanup_test_files, tool,
177 log_dump_name, fast_and_loose, build_type, in_webkit_checkout): 177 log_dump_name, fast_and_loose, build_type, in_webkit_checkout,
178 flakiness_server=None):
178 BaseTestSharder.__init__(self, attached_devices, build_type) 179 BaseTestSharder.__init__(self, attached_devices, build_type)
179 self.test_suite = test_suite 180 self.test_suite = test_suite
180 self.test_suite_basename = os.path.basename(test_suite)
181 self.gtest_filter = gtest_filter or '' 181 self.gtest_filter = gtest_filter or ''
182 self.test_arguments = test_arguments 182 self.test_arguments = test_arguments
183 self.timeout = timeout 183 self.timeout = timeout
184 self.cleanup_test_files = cleanup_test_files 184 self.cleanup_test_files = cleanup_test_files
185 self.tool = tool 185 self.tool = tool
186 self.log_dump_name = log_dump_name 186 self.log_dump_name = log_dump_name
187 self.fast_and_loose = fast_and_loose 187 self.fast_and_loose = fast_and_loose
188 self.in_webkit_checkout = in_webkit_checkout 188 self.in_webkit_checkout = in_webkit_checkout
189 self.flakiness_server = flakiness_server
189 self.all_tests = [] 190 self.all_tests = []
190 if not self.gtest_filter: 191 if not self.gtest_filter:
191 # No filter has been specified, let's add all tests then. 192 # No filter has been specified, let's add all tests then.
192 self.all_tests, self.attached_devices = self._GetAllEnabledTests() 193 self.all_tests, self.attached_devices = self._GetAllEnabledTests()
193 self.tests = self.all_tests 194 self.tests = self.all_tests
194 195
195 def _GetAllEnabledTests(self): 196 def _GetAllEnabledTests(self):
196 """Get all enabled tests and available devices. 197 """Get all enabled tests and available devices.
197 198
198 Obtains a list of enabled tests from the test package on the device, 199 Obtains a list of enabled tests from the test package on the device,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 self.test_arguments, 266 self.test_arguments,
266 self.timeout, 267 self.timeout,
267 self.cleanup_test_files, self.tool, index, 268 self.cleanup_test_files, self.tool, index,
268 not not self.log_dump_name, 269 not not self.log_dump_name,
269 self.fast_and_loose, 270 self.fast_and_loose,
270 self.build_type, 271 self.build_type,
271 self.in_webkit_checkout) 272 self.in_webkit_checkout)
272 273
273 def OnTestsCompleted(self, test_runners, test_results): 274 def OnTestsCompleted(self, test_runners, test_results):
274 """Notifies that we completed the tests.""" 275 """Notifies that we completed the tests."""
275 test_results.LogFull('Unit test', os.path.basename(self.test_suite), 276 test_results.LogFull(
276 self.build_type, self.all_tests) 277 test_type='Unit test',
278 test_package=test_runners[0].test_package.test_suite_basename,
279 build_type=self.build_type,
280 all_tests=self.all_tests,
281 flakiness_server=self.flakiness_server)
277 test_results.PrintAnnotation() 282 test_results.PrintAnnotation()
283
278 if self.log_dump_name: 284 if self.log_dump_name:
279 # Zip all debug info outputs into a file named by log_dump_name. 285 # Zip all debug info outputs into a file named by log_dump_name.
280 debug_info.GTestDebugInfo.ZipAndCleanResults( 286 debug_info.GTestDebugInfo.ZipAndCleanResults(
281 os.path.join( 287 os.path.join(
282 cmd_helper.OutDirectory.get(), self.build_type, 288 cmd_helper.OutDirectory.get(), self.build_type,
283 'debug_info_dumps'), 289 'debug_info_dumps'),
284 self.log_dump_name) 290 self.log_dump_name)
285 291
286 292
287 def _RunATestSuite(options): 293 def _RunATestSuite(options):
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 attached_devices, 346 attached_devices,
341 options.test_suite, 347 options.test_suite,
342 options.gtest_filter, 348 options.gtest_filter,
343 options.test_arguments, 349 options.test_arguments,
344 options.timeout, 350 options.timeout,
345 options.cleanup_test_files, 351 options.cleanup_test_files,
346 options.tool, 352 options.tool,
347 options.log_dump, 353 options.log_dump,
348 options.fast_and_loose, 354 options.fast_and_loose,
349 options.build_type, 355 options.build_type,
350 options.webkit) 356 options.webkit,
357 options.flakiness_dashboard_server)
351 test_results = sharder.RunShardedTests() 358 test_results = sharder.RunShardedTests()
352 359
353 for buildbot_emulator in buildbot_emulators: 360 for buildbot_emulator in buildbot_emulators:
354 buildbot_emulator.Shutdown() 361 buildbot_emulator.Shutdown()
355 362
356 return len(test_results.failed) 363 return len(test_results.failed)
357 364
358 365
359 def Dispatch(options): 366 def Dispatch(options):
360 """Dispatches the tests, sharding if possible. 367 """Dispatches the tests, sharding if possible.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 # the batch (this happens because the exit status is a sum of all failures 477 # the batch (this happens because the exit status is a sum of all failures
471 # from all suites, but the buildbot associates the exit status only with the 478 # from all suites, but the buildbot associates the exit status only with the
472 # most recent step). 479 # most recent step).
473 if options.exit_code: 480 if options.exit_code:
474 return failed_tests_count 481 return failed_tests_count
475 return 0 482 return 0
476 483
477 484
478 if __name__ == '__main__': 485 if __name__ == '__main__':
479 sys.exit(main(sys.argv)) 486 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/run_monkey_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698