| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs each test cases as a single shard, single process execution. | 6 """Runs each test cases as a single shard, single process execution. |
| 7 | 7 |
| 8 Similar to sharding_supervisor.py but finer grained. It runs each test case | 8 Similar to sharding_supervisor.py but finer grained. It runs each test case |
| 9 individually instead of running per shard. Runs multiple instances in parallel. | 9 individually instead of running per shard. Runs multiple instances in parallel. |
| 10 """ | 10 """ |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 if not clusters: | 1175 if not clusters: |
| 1176 clusters = calc_cluster_default(len(test_cases), jobs) | 1176 clusters = calc_cluster_default(len(test_cases), jobs) |
| 1177 else: | 1177 else: |
| 1178 # Limit the value. | 1178 # Limit the value. |
| 1179 clusters = max(min(clusters, len(test_cases) / jobs), 1) | 1179 clusters = max(min(clusters, len(test_cases) / jobs), 1) |
| 1180 | 1180 |
| 1181 logging.debug('%d test cases with clusters of %d', len(test_cases), clusters) | 1181 logging.debug('%d test cases with clusters of %d', len(test_cases), clusters) |
| 1182 | 1182 |
| 1183 if gtest_output: | 1183 if gtest_output: |
| 1184 gtest_output = gen_gtest_output_dir(cwd, gtest_output) | 1184 gtest_output = gen_gtest_output_dir(cwd, gtest_output) |
| 1185 progress = threading_utils.Progress(len(test_cases)) | 1185 columns = [('index', 0), ('size', len(test_cases))] |
| 1186 progress = threading_utils.Progress(columns) |
| 1186 progress.use_cr_only = not no_cr | 1187 progress.use_cr_only = not no_cr |
| 1187 serial_tasks = threading_utils.QueueWithProgress(0) | 1188 serial_tasks = threading_utils.QueueWithProgress(progress) |
| 1188 serial_tasks.set_progress(progress) | |
| 1189 | 1189 |
| 1190 def add_serial_task(priority, func, *args, **kwargs): | 1190 def add_serial_task(priority, func, *args, **kwargs): |
| 1191 """Adds a serial task, to be executed later.""" | 1191 """Adds a serial task, to be executed later.""" |
| 1192 assert isinstance(priority, int) | 1192 assert isinstance(priority, int) |
| 1193 assert callable(func) | 1193 assert callable(func) |
| 1194 serial_tasks.put((priority, func, args, kwargs)) | 1194 serial_tasks.put((priority, func, args, kwargs)) |
| 1195 | 1195 |
| 1196 with threading_utils.ThreadPoolWithProgress( | 1196 with threading_utils.ThreadPoolWithProgress( |
| 1197 progress, jobs, jobs, len(test_cases)) as pool: | 1197 progress, jobs, jobs, len(test_cases)) as pool: |
| 1198 runner = ChromiumGoogleTestRunner( | 1198 runner = ChromiumGoogleTestRunner( |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 options.gtest_output, | 1599 options.gtest_output, |
| 1600 result_file, | 1600 result_file, |
| 1601 options.verbose) | 1601 options.verbose) |
| 1602 except Failure as e: | 1602 except Failure as e: |
| 1603 print >> sys.stderr, e.args[0] | 1603 print >> sys.stderr, e.args[0] |
| 1604 return 1 | 1604 return 1 |
| 1605 | 1605 |
| 1606 | 1606 |
| 1607 if __name__ == '__main__': | 1607 if __name__ == '__main__': |
| 1608 sys.exit(main(sys.argv[1:])) | 1608 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |