OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 | 8 |
9 import '../../frontend/timeout.dart'; | 9 import '../../frontend/timeout.dart'; |
10 import '../../backend/test_platform.dart'; | 10 import '../../backend/test_platform.dart'; |
(...skipping 12 matching lines...) Loading... |
23 parser.addFlag("help", abbr: "h", negatable: false, | 23 parser.addFlag("help", abbr: "h", negatable: false, |
24 help: "Shows this usage information."); | 24 help: "Shows this usage information."); |
25 parser.addFlag("version", negatable: false, | 25 parser.addFlag("version", negatable: false, |
26 help: "Shows the package's version."); | 26 help: "Shows the package's version."); |
27 parser.addOption("package-root", hide: true); | 27 parser.addOption("package-root", hide: true); |
28 | 28 |
29 // Note that defaultsTo declarations here are only for documentation purposes. | 29 // Note that defaultsTo declarations here are only for documentation purposes. |
30 // We pass null values rather than defaults to [new Configuration] so that it | 30 // We pass null values rather than defaults to [new Configuration] so that it |
31 // merges properly with the config file. | 31 // merges properly with the config file. |
32 | 32 |
33 parser.addSeparator("======== Selecting Tests"); | |
34 parser.addOption("name", | 33 parser.addOption("name", |
35 abbr: 'n', | 34 abbr: 'n', |
36 help: 'A substring of the name of the test to run.\n' | 35 help: 'A substring of the name of the test to run.\n' |
37 'Regular expression syntax is supported.'); | 36 'Regular expression syntax is supported.'); |
38 parser.addOption("plain-name", | 37 parser.addOption("plain-name", |
39 abbr: 'N', | 38 abbr: 'N', |
40 help: 'A plain-text substring of the name of the test to run.'); | 39 help: 'A plain-text substring of the name of the test to run.'); |
41 // TODO(nweiz): Support the full platform-selector syntax for choosing which | 40 // TODO(nweiz): Support the full platform-selector syntax for choosing which |
42 // tags to run. In the shorter term, disallow non-"identifier" tags. | 41 // tags to run. In the shorter term, disallow non-"identifier" tags. |
43 parser.addOption("tags", | 42 parser.addOption("tags", |
44 abbr: 't', | 43 abbr: 't', |
45 help: 'Run only tests with all of the specified tags.', | 44 help: 'Run only tests with all of the specified tags.', |
46 allowMultiple: true); | 45 allowMultiple: true); |
47 parser.addOption("tag", hide: true, allowMultiple: true); | 46 parser.addOption("tag", hide: true, allowMultiple: true); |
48 parser.addOption("exclude-tags", | 47 parser.addOption("exclude-tags", |
49 abbr: 'x', | 48 abbr: 'x', |
50 help: "Don't run tests with any of the specified tags.", | 49 help: "Don't run tests with any of the specified tags.", |
51 allowMultiple: true); | 50 allowMultiple: true); |
52 parser.addOption("exclude-tag", hide: true, allowMultiple: true); | 51 parser.addOption("exclude-tag", hide: true, allowMultiple: true); |
53 | 52 |
54 parser.addSeparator("======== Running Tests"); | |
55 parser.addOption("platform", | 53 parser.addOption("platform", |
56 abbr: 'p', | 54 abbr: 'p', |
57 help: 'The platform(s) on which to run the tests.', | 55 help: 'The platform(s) on which to run the tests.', |
58 defaultsTo: 'vm', | 56 defaultsTo: 'vm', |
59 allowed: allPlatforms.map((platform) => platform.identifier).toList(), | 57 allowed: allPlatforms.map((platform) => platform.identifier).toList(), |
60 allowMultiple: true); | 58 allowMultiple: true); |
61 parser.addOption("concurrency", | 59 parser.addOption("concurrency", |
62 abbr: 'j', | 60 abbr: 'j', |
63 help: 'The number of concurrent test suites run.', | 61 help: 'The number of concurrent test suites run.', |
64 defaultsTo: defaultConcurrency.toString(), | 62 defaultsTo: defaultConcurrency.toString(), |
65 valueHelp: 'threads'); | 63 valueHelp: 'threads'); |
66 parser.addOption("pub-serve", | 64 parser.addOption("pub-serve", |
67 help: 'The port of a pub serve instance serving "test/".', | 65 help: 'The port of a pub serve instance serving "test/".', |
68 valueHelp: 'port'); | 66 valueHelp: 'port'); |
69 parser.addOption("timeout", | 67 parser.addOption("timeout", |
70 help: 'The default test timeout. For example: 15s, 2x, none', | 68 help: 'The default test timeout. For example: 15s, 2x, none', |
71 defaultsTo: '30s'); | 69 defaultsTo: '30s'); |
72 parser.addFlag("pause-after-load", | 70 parser.addFlag("pause-after-load", |
73 help: 'Pauses for debugging before any tests execute.\n' | 71 help: 'Pauses for debugging before any tests execute.\n' |
74 'Implies --concurrency=1 and --timeout=none.\n' | 72 'Implies --concurrency=1 and --timeout=none.\n' |
75 'Currently only supported for browser tests.', | 73 'Currently only supported for browser tests.', |
76 negatable: false); | 74 negatable: false); |
77 | 75 |
78 parser.addSeparator("======== Output"); | |
79 parser.addOption("reporter", | 76 parser.addOption("reporter", |
80 abbr: 'r', | 77 abbr: 'r', |
81 help: 'The runner used to print test results.', | 78 help: 'The runner used to print test results.', |
82 defaultsTo: defaultReporter, | 79 defaultsTo: defaultReporter, |
83 allowed: allReporters, | 80 allowed: allReporters, |
84 allowedHelp: { | 81 allowedHelp: { |
85 'compact': 'A single line, updated continuously.', | 82 'compact': 'A single line, updated continuously.', |
86 'expanded': 'A separate line for each update.', | 83 'expanded': 'A separate line for each update.', |
87 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' | 84 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' |
88 }); | 85 }); |
(...skipping 79 matching lines...) Loading... |
168 var value = options[name]; | 165 var value = options[name]; |
169 if (value == null) return null; | 166 if (value == null) return null; |
170 | 167 |
171 try { | 168 try { |
172 return parse(value); | 169 return parse(value); |
173 } on FormatException catch (error) { | 170 } on FormatException catch (error) { |
174 throw new FormatException('Couldn\'t parse --$name "${options[name]}": ' | 171 throw new FormatException('Couldn\'t parse --$name "${options[name]}": ' |
175 '${error.message}'); | 172 '${error.message}'); |
176 } | 173 } |
177 } | 174 } |
OLD | NEW |