OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import argparse | 5 import argparse |
6 import multiprocessing | 6 import multiprocessing |
7 import sys | 7 import sys |
8 | 8 |
9 from .cover import CoverageContext | 9 from .cover import CoverageContext |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 help='run N jobs in parallel (default %(default)s)') | 55 help='run N jobs in parallel (default %(default)s)') |
56 | 56 |
57 sp.add_argument( | 57 sp.add_argument( |
58 '--test_list', metavar='FILE', | 58 '--test_list', metavar='FILE', |
59 help='take the list of test globs from the FILE (use "-" for stdin)') | 59 help='take the list of test globs from the FILE (use "-" for stdin)') |
60 | 60 |
61 sp.add_argument( | 61 sp.add_argument( |
62 'test_glob', nargs='*', help=( | 62 'test_glob', nargs='*', help=( |
63 'glob to filter the tests acted on. If the glob begins with "-" ' | 63 'glob to filter the tests acted on. If the glob begins with "-" ' |
64 'then it acts as a negation glob and anything which matches it ' | 64 'then it acts as a negation glob and anything which matches it ' |
65 'will be skipped.')) | 65 'will be skipped. If a glob doesn\'t have "*" in it, "*" will be ' |
| 66 'implicitly appended to the end')) |
66 | 67 |
67 opts = parser.parse_args(args) | 68 opts = parser.parse_args(args) |
68 | 69 |
69 if not hasattr(opts, 'jobs'): | 70 if not hasattr(opts, 'jobs'): |
70 opts.jobs = 0 | 71 opts.jobs = 0 |
71 elif opts.jobs < 1: | 72 elif opts.jobs < 1: |
72 parser.error('--jobs was less than 1') | 73 parser.error('--jobs was less than 1') |
73 | 74 |
74 if opts.test_list: | 75 if opts.test_list: |
75 fh = sys.stdin if opts.test_list == '-' else open(opts.test_list, 'rb') | 76 fh = sys.stdin if opts.test_list == '-' else open(opts.test_list, 'rb') |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 opts) | 119 opts) |
119 | 120 |
120 cover_ctx.cleanup() | 121 cover_ctx.cleanup() |
121 if not killed and not opts.test_glob: | 122 if not killed and not opts.test_glob: |
122 if not cover_ctx.report(opts.verbose): | 123 if not cover_ctx.report(opts.verbose): |
123 sys.exit(2) | 124 sys.exit(2) |
124 | 125 |
125 sys.exit(error or killed) | 126 sys.exit(error or killed) |
126 except KeyboardInterrupt: | 127 except KeyboardInterrupt: |
127 pass | 128 pass |
OLD | NEW |