OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Shards a given test suite and runs the shards in parallel. | 6 """Shards a given test suite and runs the shards in parallel. |
7 | 7 |
8 ShardingSupervisor is called to process the command line options and creates | 8 ShardingSupervisor is called to process the command line options and creates |
9 the specified number of worker threads. These threads then run each shard of | 9 the specified number of worker threads. These threads then run each shard of |
10 the test in a separate process and report on the results. When all the shards | 10 the test in a separate process and report on the results. When all the shards |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 test_args = AppendToGTestOutput(gtest_args, str(index)) | 175 test_args = AppendToGTestOutput(gtest_args, str(index)) |
176 args.extend(test_args) | 176 args.extend(test_args) |
177 env = os.environ.copy() | 177 env = os.environ.copy() |
178 env["GTEST_TOTAL_SHARDS"] = str(total_shards) | 178 env["GTEST_TOTAL_SHARDS"] = str(total_shards) |
179 env["GTEST_SHARD_INDEX"] = str(index) | 179 env["GTEST_SHARD_INDEX"] = str(index) |
180 | 180 |
181 # Use a unique log file for each shard | 181 # Use a unique log file for each shard |
182 # Allows ui_tests to be run in parallel on the same machine | 182 # Allows ui_tests to be run in parallel on the same machine |
183 env["CHROME_LOG_FILE"] = "chrome_log_%d" % index | 183 env["CHROME_LOG_FILE"] = "chrome_log_%d" % index |
184 | 184 |
185 sys.stderr.write('RUNNING: [%s]\n' % str(args)); | |
186 | |
187 return subprocess.Popen( | 185 return subprocess.Popen( |
188 args, stdout=stdout, | 186 args, stdout=stdout, |
189 stderr=stderr, | 187 stderr=stderr, |
190 env=env, | 188 env=env, |
191 bufsize=0, | 189 bufsize=0, |
192 universal_newlines=True) | 190 universal_newlines=True) |
193 | 191 |
194 | 192 |
195 class ShardRunner(threading.Thread): | 193 class ShardRunner(threading.Thread): |
196 """Worker thread that manages a single shard at a time. | 194 """Worker thread that manages a single shard at a time. |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 # shard and run the whole test | 659 # shard and run the whole test |
662 ss = ShardingSupervisor( | 660 ss = ShardingSupervisor( |
663 test, num_shards_to_run, num_runs, options.color, | 661 test, num_shards_to_run, num_runs, options.color, |
664 options.original_order, options.prefix, options.retry_percent, | 662 options.original_order, options.prefix, options.retry_percent, |
665 options.timeout, options.total_slaves, options.slave_index, gtest_args) | 663 options.timeout, options.total_slaves, options.slave_index, gtest_args) |
666 return ss.ShardTest() | 664 return ss.ShardTest() |
667 | 665 |
668 | 666 |
669 if __name__ == "__main__": | 667 if __name__ == "__main__": |
670 sys.exit(main()) | 668 sys.exit(main()) |
OLD | NEW |