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

Side by Side Diff: googletest/run_test_cases.py

Issue 25478012: Make Progress support an arbitrary number of columns. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/tools/swarm_client@1_progress
Patch Set: Kept Progress.start public Created 7 years, 2 months 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
« no previous file with comments | « no previous file | googletest/trace_test_cases.py » ('j') | 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 # 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
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
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:]))
OLDNEW
« no previous file with comments | « no previous file | googletest/trace_test_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698