| 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...) Expand all 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"); |
| 33 parser.addOption("name", | 34 parser.addOption("name", |
| 34 abbr: 'n', | 35 abbr: 'n', |
| 35 help: 'A substring of the name of the test to run.\n' | 36 help: 'A substring of the name of the test to run.\n' |
| 36 'Regular expression syntax is supported.'); | 37 'Regular expression syntax is supported.'); |
| 37 parser.addOption("plain-name", | 38 parser.addOption("plain-name", |
| 38 abbr: 'N', | 39 abbr: 'N', |
| 39 help: 'A plain-text substring of the name of the test to run.'); | 40 help: 'A plain-text substring of the name of the test to run.'); |
| 40 // TODO(nweiz): Support the full platform-selector syntax for choosing which | 41 // TODO(nweiz): Support the full platform-selector syntax for choosing which |
| 41 // tags to run. In the shorter term, disallow non-"identifier" tags. | 42 // tags to run. In the shorter term, disallow non-"identifier" tags. |
| 42 parser.addOption("tags", | 43 parser.addOption("tags", |
| 43 abbr: 't', | 44 abbr: 't', |
| 44 help: 'Run only tests with all of the specified tags.', | 45 help: 'Run only tests with all of the specified tags.', |
| 45 allowMultiple: true); | 46 allowMultiple: true); |
| 46 parser.addOption("tag", hide: true, allowMultiple: true); | 47 parser.addOption("tag", hide: true, allowMultiple: true); |
| 47 parser.addOption("exclude-tags", | 48 parser.addOption("exclude-tags", |
| 48 abbr: 'x', | 49 abbr: 'x', |
| 49 help: "Don't run tests with any of the specified tags.", | 50 help: "Don't run tests with any of the specified tags.", |
| 50 allowMultiple: true); | 51 allowMultiple: true); |
| 51 parser.addOption("exclude-tag", hide: true, allowMultiple: true); | 52 parser.addOption("exclude-tag", hide: true, allowMultiple: true); |
| 52 | 53 |
| 54 parser.addSeparator("======== Running Tests"); |
| 53 parser.addOption("platform", | 55 parser.addOption("platform", |
| 54 abbr: 'p', | 56 abbr: 'p', |
| 55 help: 'The platform(s) on which to run the tests.', | 57 help: 'The platform(s) on which to run the tests.', |
| 56 defaultsTo: 'vm', | 58 defaultsTo: 'vm', |
| 57 allowed: allPlatforms.map((platform) => platform.identifier).toList(), | 59 allowed: allPlatforms.map((platform) => platform.identifier).toList(), |
| 58 allowMultiple: true); | 60 allowMultiple: true); |
| 59 parser.addOption("concurrency", | 61 parser.addOption("concurrency", |
| 60 abbr: 'j', | 62 abbr: 'j', |
| 61 help: 'The number of concurrent test suites run.', | 63 help: 'The number of concurrent test suites run.', |
| 62 defaultsTo: defaultConcurrency.toString(), | 64 defaultsTo: defaultConcurrency.toString(), |
| 63 valueHelp: 'threads'); | 65 valueHelp: 'threads'); |
| 64 parser.addOption("pub-serve", | 66 parser.addOption("pub-serve", |
| 65 help: 'The port of a pub serve instance serving "test/".', | 67 help: 'The port of a pub serve instance serving "test/".', |
| 66 valueHelp: 'port'); | 68 valueHelp: 'port'); |
| 67 parser.addOption("timeout", | 69 parser.addOption("timeout", |
| 68 help: 'The default test timeout. For example: 15s, 2x, none', | 70 help: 'The default test timeout. For example: 15s, 2x, none', |
| 69 defaultsTo: '30s'); | 71 defaultsTo: '30s'); |
| 70 parser.addFlag("pause-after-load", | 72 parser.addFlag("pause-after-load", |
| 71 help: 'Pauses for debugging before any tests execute.\n' | 73 help: 'Pauses for debugging before any tests execute.\n' |
| 72 'Implies --concurrency=1 and --timeout=none.\n' | 74 'Implies --concurrency=1 and --timeout=none.\n' |
| 73 'Currently only supported for browser tests.', | 75 'Currently only supported for browser tests.', |
| 74 negatable: false); | 76 negatable: false); |
| 75 | 77 |
| 78 parser.addSeparator("======== Output"); |
| 76 parser.addOption("reporter", | 79 parser.addOption("reporter", |
| 77 abbr: 'r', | 80 abbr: 'r', |
| 78 help: 'The runner used to print test results.', | 81 help: 'The runner used to print test results.', |
| 79 defaultsTo: defaultReporter, | 82 defaultsTo: defaultReporter, |
| 80 allowed: allReporters, | 83 allowed: allReporters, |
| 81 allowedHelp: { | 84 allowedHelp: { |
| 82 'compact': 'A single line, updated continuously.', | 85 'compact': 'A single line, updated continuously.', |
| 83 'expanded': 'A separate line for each update.', | 86 'expanded': 'A separate line for each update.', |
| 84 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' | 87 'json': 'A machine-readable format (see https://goo.gl/0HRhdZ).' |
| 85 }); | 88 }); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 var value = options[name]; | 168 var value = options[name]; |
| 166 if (value == null) return null; | 169 if (value == null) return null; |
| 167 | 170 |
| 168 try { | 171 try { |
| 169 return parse(value); | 172 return parse(value); |
| 170 } on FormatException catch (error) { | 173 } on FormatException catch (error) { |
| 171 throw new FormatException('Couldn\'t parse --$name "${options[name]}": ' | 174 throw new FormatException('Couldn\'t parse --$name "${options[name]}": ' |
| 172 '${error.message}'); | 175 '${error.message}'); |
| 173 } | 176 } |
| 174 } | 177 } |
| OLD | NEW |