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