OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 not not self.log_dump_name, | 189 not not self.log_dump_name, |
190 self.build_type, | 190 self.build_type, |
191 self.in_webkit_checkout) | 191 self.in_webkit_checkout) |
192 | 192 |
193 def OnTestsCompleted(self, test_runners, test_results): | 193 def OnTestsCompleted(self, test_runners, test_results): |
194 """Notifies that we completed the tests.""" | 194 """Notifies that we completed the tests.""" |
195 test_results.LogFull( | 195 test_results.LogFull( |
196 test_type='Unit test', | 196 test_type='Unit test', |
197 test_package=test_runners[0].test_package.test_suite_basename, | 197 test_package=test_runners[0].test_package.test_suite_basename, |
198 build_type=self.build_type, | 198 build_type=self.build_type, |
199 all_tests=self.all_tests, | |
200 flakiness_server=self.flakiness_server) | 199 flakiness_server=self.flakiness_server) |
201 test_results.PrintAnnotation() | 200 test_results.PrintAnnotation() |
202 | 201 |
203 if self.log_dump_name: | 202 if self.log_dump_name: |
204 # Zip all debug info outputs into a file named by log_dump_name. | 203 # Zip all debug info outputs into a file named by log_dump_name. |
205 debug_info.GTestDebugInfo.ZipAndCleanResults( | 204 debug_info.GTestDebugInfo.ZipAndCleanResults( |
206 os.path.join( | 205 os.path.join( |
207 cmd_helper.OutDirectory.get(), self.build_type, | 206 cmd_helper.OutDirectory.get(), self.build_type, |
208 'debug_info_dumps'), | 207 'debug_info_dumps'), |
209 self.log_dump_name) | 208 self.log_dump_name) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 options.tool, | 257 options.tool, |
259 options.log_dump, | 258 options.log_dump, |
260 options.build_type, | 259 options.build_type, |
261 options.webkit, | 260 options.webkit, |
262 options.flakiness_dashboard_server) | 261 options.flakiness_dashboard_server) |
263 test_results = sharder.RunShardedTests() | 262 test_results = sharder.RunShardedTests() |
264 | 263 |
265 for buildbot_emulator in buildbot_emulators: | 264 for buildbot_emulator in buildbot_emulators: |
266 buildbot_emulator.Shutdown() | 265 buildbot_emulator.Shutdown() |
267 | 266 |
268 return len(test_results.failed) | 267 return len(test_results.GetAllBroken()) |
269 | 268 |
270 | 269 |
271 def Dispatch(options): | 270 def Dispatch(options): |
272 """Dispatches the tests, sharding if possible. | 271 """Dispatches the tests, sharding if possible. |
273 | 272 |
274 If options.use_emulator is True, all tests will be run in new emulator | 273 If options.use_emulator is True, all tests will be run in new emulator |
275 instance. | 274 instance. |
276 | 275 |
277 Args: | 276 Args: |
278 options: options for running the tests. | 277 options: options for running the tests. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 # the batch (this happens because the exit status is a sum of all failures | 333 # the batch (this happens because the exit status is a sum of all failures |
335 # from all suites, but the buildbot associates the exit status only with the | 334 # from all suites, but the buildbot associates the exit status only with the |
336 # most recent step). | 335 # most recent step). |
337 if options.exit_code: | 336 if options.exit_code: |
338 return failed_tests_count | 337 return failed_tests_count |
339 return 0 | 338 return 0 |
340 | 339 |
341 | 340 |
342 if __name__ == '__main__': | 341 if __name__ == '__main__': |
343 sys.exit(main(sys.argv)) | 342 sys.exit(main(sys.argv)) |
OLD | NEW |