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 """Defer to run_test_cases.py.""" | 6 """Defer to run_test_cases.py.""" |
7 | 7 |
8 import os | 8 import os |
9 import optparse | 9 import optparse |
10 import sys | 10 import sys |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 '--no-color', action='store_true', help='Ignored') | 49 '--no-color', action='store_true', help='Ignored') |
50 group.add_option( | 50 group.add_option( |
51 '--retry-failed', action='store_true', help='Ignored') | 51 '--retry-failed', action='store_true', help='Ignored') |
52 group.add_option( | 52 group.add_option( |
53 '-t', '--timeout', type='int', help='Kept as --timeout') | 53 '-t', '--timeout', type='int', help='Kept as --timeout') |
54 group.add_option( | 54 group.add_option( |
55 '--total-slaves', type='int', default=1, help='Converted to --index') | 55 '--total-slaves', type='int', default=1, help='Converted to --index') |
56 group.add_option( | 56 group.add_option( |
57 '--slave-index', type='int', default=0, help='Converted to --shards') | 57 '--slave-index', type='int', default=0, help='Converted to --shards') |
58 parser.add_option_group(group) | 58 parser.add_option_group(group) |
59 group = optparse.OptionGroup( | |
60 parser, 'Options of run_test_cases.py passed through') | |
61 group.add_option( | |
62 '--retries', type='int', help='Kept as --retries') | |
63 group.add_option( | |
64 '--verbose', action='store_true', help='Kept as --verbose') | |
M-A Ruel
2013/08/12 14:29:59
default=0, action='count'
Alexander Potapenko
2013/08/12 14:33:53
Done.
| |
65 parser.add_option_group(group) | |
59 | 66 |
60 parser.disable_interspersed_args() | 67 parser.disable_interspersed_args() |
61 options, args = parser.parse_args() | 68 options, args = parser.parse_args() |
62 | 69 |
63 swarm_client_dir = os.path.join( | 70 swarm_client_dir = os.path.join( |
64 ROOT_DIR, 'tools', 'swarm_client', 'googletest') | 71 ROOT_DIR, 'tools', 'swarm_client', 'googletest') |
65 sys.path.insert(0, swarm_client_dir) | 72 sys.path.insert(0, swarm_client_dir) |
66 | 73 |
67 cmd = [ | 74 cmd = [ |
68 '--shards', str(options.total_slaves), | 75 '--shards', str(options.total_slaves), |
69 '--index', str(options.slave_index), | 76 '--index', str(options.slave_index), |
70 '--no-dump', | 77 '--no-dump', |
71 '--no-cr', | 78 '--no-cr', |
72 ] | 79 ] |
73 if options.timeout is not None: | 80 if options.timeout is not None: |
74 cmd.extend(['--timeout', str(options.timeout)]) | 81 cmd.extend(['--timeout', str(options.timeout)]) |
82 if options.retries is not None: | |
83 cmd.extend(['--retries', str(options.retries)]) | |
84 if options.verbose is not None: | |
85 cmd.extend(['--verbose']) | |
M-A Ruel
2013/08/12 14:29:59
cmd.extend(['--verbose'] * options.verbose)
Alexander Potapenko
2013/08/12 14:33:53
Done.
| |
75 | 86 |
76 run_test_cases_extra_args, rest = pop_known_arguments(args) | 87 run_test_cases_extra_args, rest = pop_known_arguments(args) |
77 | 88 |
78 import run_test_cases # pylint: disable=F0401 | 89 import run_test_cases # pylint: disable=F0401 |
79 | 90 |
80 return run_test_cases.main(cmd + run_test_cases_extra_args + ['--'] + rest) | 91 return run_test_cases.main(cmd + run_test_cases_extra_args + ['--'] + rest) |
81 | 92 |
82 | 93 |
83 if __name__ == '__main__': | 94 if __name__ == '__main__': |
84 sys.exit(main()) | 95 sys.exit(main()) |
OLD | NEW |