OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 3 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license | 5 # Use of this source code is governed by a BSD-style license |
6 # that can be found in the LICENSE file in the root of the source | 6 # that can be found in the LICENSE file in the root of the source |
7 # tree. An additional intellectual property rights grant can be found | 7 # tree. An additional intellectual property rights grant can be found |
8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 gtest_parallel_path = os.path.dirname(os.path.abspath(__file__)) | 52 gtest_parallel_path = os.path.dirname(os.path.abspath(__file__)) |
53 gtest_parallel_path = os.path.join(gtest_parallel_path, 'gtest-parallel') | 53 gtest_parallel_path = os.path.join(gtest_parallel_path, 'gtest-parallel') |
54 | 54 |
55 # Ignore '--'. Options unprocessed by this script will be passed to the test as | 55 # Ignore '--'. Options unprocessed by this script will be passed to the test as |
56 # arguments. | 56 # arguments. |
57 if '--' in sys.argv: | 57 if '--' in sys.argv: |
58 del sys.argv[sys.argv.index('--')] | 58 del sys.argv[sys.argv.index('--')] |
59 | 59 |
60 parser = argparse.ArgumentParser() | 60 parser = argparse.ArgumentParser() |
61 parser.add_argument('--isolated-script-test-output', type=str, default=None) | 61 parser.add_argument('--isolated-script-test-output', type=str, default=None) |
| 62 parser.add_argument('--output_dir', type=str, default=None) |
| 63 parser.add_argument('--timeout', type=int, default=None) |
62 | 64 |
63 options, unprocessed = parser.parse_known_args() | 65 options, unprocessed = parser.parse_known_args() |
64 test_executable = unprocessed[0] | 66 test_executable = unprocessed[0] |
65 test_arguments = unprocessed[1:] | 67 test_arguments = unprocessed[1:] |
66 | 68 |
67 gtest_args = [ | 69 gtest_args = [ |
68 test_executable, | 70 test_executable, |
69 '--shard_count', | 71 '--shard_count', |
70 gtest_total_shards, | 72 gtest_total_shards, |
71 '--shard_index', | 73 '--shard_index', |
72 gtest_shard_index, | 74 gtest_shard_index, |
73 ] | 75 ] |
74 | 76 |
75 # --isolated-script-test-output is used to upload results to the flakiness | 77 # --isolated-script-test-output is used to upload results to the flakiness |
76 # dashboard. This translation is made because gtest-parallel expects the flag to | 78 # dashboard. This translation is made because gtest-parallel expects the flag to |
77 # be called --dump_json_test_results instead. | 79 # be called --dump_json_test_results instead. |
78 if options.isolated_script_test_output: | 80 if options.isolated_script_test_output: |
79 gtest_args += [ | 81 gtest_args += [ |
80 '--dump_json_test_results', | 82 '--dump_json_test_results', |
81 options.isolated_script_test_output, | 83 options.isolated_script_test_output, |
82 ] | 84 ] |
83 | 85 |
| 86 if options.output_dir: |
| 87 gtest_args += [ |
| 88 '--output_dir', |
| 89 options.output_dir, |
| 90 ] |
| 91 |
| 92 if options.timeout: |
| 93 gtest_args += [ |
| 94 '--timeout', |
| 95 str(options.timeout), |
| 96 ] |
| 97 |
84 command = [ | 98 command = [ |
85 sys.executable, | 99 sys.executable, |
86 gtest_parallel_path, | 100 gtest_parallel_path, |
87 ] + gtest_args + ['--'] + test_arguments | 101 ] + gtest_args + ['--'] + test_arguments |
88 | 102 |
89 print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command) | 103 print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command) |
90 sys.stdout.flush() | 104 sys.stdout.flush() |
91 | 105 |
92 sys.exit(subprocess.call(command, env=test_env, cwd=os.getcwd())) | 106 sys.exit(subprocess.call(command, env=test_env, cwd=os.getcwd())) |
OLD | NEW |