| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 """Creates a suite-specific test runner. | 169 """Creates a suite-specific test runner. |
| 170 | 170 |
| 171 Args: | 171 Args: |
| 172 device: Device serial where this shard will run. | 172 device: Device serial where this shard will run. |
| 173 index: Index of this device in the pool. | 173 index: Index of this device in the pool. |
| 174 | 174 |
| 175 Returns: | 175 Returns: |
| 176 A SingleTestRunner object. | 176 A SingleTestRunner object. |
| 177 """ | 177 """ |
| 178 device_num = len(self.attached_devices) | 178 device_num = len(self.attached_devices) |
| 179 shard_size = (len(self.tests) + device_num - 1) / device_num | 179 shard_test_list = self.tests[index::device_num] |
| 180 shard_test_list = self.tests[index * shard_size : (index + 1) * shard_size] | |
| 181 test_filter = ':'.join(shard_test_list) + self.gtest_filter | 180 test_filter = ':'.join(shard_test_list) + self.gtest_filter |
| 182 return SingleTestRunner( | 181 return SingleTestRunner( |
| 183 device, | 182 device, |
| 184 self.test_suite, | 183 self.test_suite, |
| 185 test_filter, | 184 test_filter, |
| 186 self.test_arguments, | 185 self.test_arguments, |
| 187 self.timeout, | 186 self.timeout, |
| 188 self.cleanup_test_files, self.tool, index, | 187 self.cleanup_test_files, self.tool, index, |
| 189 not not self.log_dump_name, | 188 not not self.log_dump_name, |
| 190 self.build_type, | 189 self.build_type, |
| (...skipping 142 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 |