Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: packages/args/example/test_runner.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/args/codereview.settings ('k') | packages/args/lib/args.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 /// This is an example of converting the args in test.dart to use this API.
6 /// It shows what it looks like to build an [ArgParser] and then, when the code
7 /// is run, demonstrates what the generated usage text looks like.
8 library example;
9
10 import 'dart:io';
11
12 import 'package:args/args.dart';
13
14 main() {
15 var parser = new ArgParser();
16
17 parser.addSeparator('===== Platform');
18
19 parser.addOption('compiler',
20 abbr: 'c',
21 defaultsTo: 'none',
22 help: 'Specify any compilation step (if needed).',
23 allowed: ['none', 'dart2js', 'dartc'],
24 allowedHelp: {
25 'none': 'Do not compile the Dart code (run native Dart code on the'
26 ' VM).\n(only valid with the following runtimes: vm, drt)',
27 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n'
28 '(only valid with the following runtimes: d8, drt, chrome\n'
29 'safari, ie, firefox, opera, none (compile only))',
30 'dartc': 'Perform static analysis on Dart code by running dartc.\n'
31 '(only valid with the following runtimes: none)',
32 });
33
34 parser.addOption('runtime',
35 abbr: 'r',
36 defaultsTo: 'vm',
37 help: 'Where the tests should be run.',
38 allowed: [
39 'vm',
40 'd8',
41 'drt',
42 'dartium',
43 'ff',
44 'firefox',
45 'chrome',
46 'safari',
47 'ie',
48 'opera',
49 'none'
50 ],
51 allowedHelp: {
52 'vm': 'Run Dart code on the standalone dart vm.',
53 'd8': 'Run JavaScript from the command line using v8.',
54 // TODO(antonm): rename flag.
55 'drt': 'Run Dart or JavaScript in the headless version of Chrome,\n'
56 'content shell.',
57 'dartium': 'Run Dart or JavaScript in Dartium.',
58 'ff': 'Run JavaScript in Firefox',
59 'chrome': 'Run JavaScript in Chrome',
60 'safari': 'Run JavaScript in Safari',
61 'ie': 'Run JavaScript in Internet Explorer',
62 'opera': 'Run JavaScript in Opera',
63 'none': 'No runtime, compile only (for example, used for dartc static\n'
64 'analysis tests).',
65 });
66
67 parser.addOption('arch',
68 abbr: 'a',
69 defaultsTo: 'ia32',
70 help: 'The architecture to run tests for',
71 allowed: ['all', 'ia32', 'x64', 'simarm']);
72
73 parser.addOption('system',
74 abbr: 's',
75 defaultsTo: Platform.operatingSystem,
76 help: 'The operating system to run tests on',
77 allowed: ['linux', 'macos', 'windows']);
78
79 parser.addSeparator('===== Runtime');
80
81 parser.addOption('mode',
82 abbr: 'm',
83 defaultsTo: 'debug',
84 help: 'Mode in which to run the tests',
85 allowed: ['all', 'debug', 'release']);
86
87 parser.addFlag('checked',
88 defaultsTo: false, help: 'Run tests in checked mode');
89
90 parser.addFlag('host-checked',
91 defaultsTo: false, help: 'Run compiler in checked mode');
92
93 parser.addOption('timeout', abbr: 't', help: 'Timeout in seconds');
94
95 parser.addOption('tasks',
96 abbr: 'j',
97 defaultsTo: Platform.numberOfProcessors.toString(),
98 help: 'The number of parallel tasks to run');
99
100 parser.addOption('shards',
101 defaultsTo: '1',
102 help: 'The number of instances that the tests will be sharded over');
103
104 parser.addOption('shard',
105 defaultsTo: '1',
106 help: 'The index of this instance when running in sharded mode');
107
108 parser.addFlag('valgrind',
109 defaultsTo: false, help: 'Run tests through valgrind');
110
111 parser.addSeparator('===== Output');
112
113 parser.addOption('progress',
114 abbr: 'p',
115 defaultsTo: 'compact',
116 help: 'Progress indication mode',
117 allowed: [
118 'compact',
119 'color',
120 'line',
121 'verbose',
122 'silent',
123 'status',
124 'buildbot'
125 ]);
126
127 parser.addFlag('report',
128 defaultsTo: false,
129 help: 'Print a summary report of the number of tests, by expectation');
130
131 parser.addFlag('verbose',
132 abbr: 'v', defaultsTo: false, help: 'Verbose output');
133
134 parser.addFlag('list',
135 defaultsTo: false, help: 'List tests only, do not run them');
136
137 parser.addFlag('time',
138 help: 'Print timing information after running tests', defaultsTo: false);
139
140 parser.addFlag('batch',
141 abbr: 'b', help: 'Run browser tests in batch mode', defaultsTo: true);
142
143 parser.addSeparator('===== Miscellaneous');
144
145 parser.addFlag('keep-generated-tests',
146 defaultsTo: false,
147 help: 'Keep the generated files in the temporary directory');
148
149 parser.addOption('special-command', help: """
150 Special command support. Wraps the command line in
151 a special command. The special command should contain
152 an '@' character which will be replaced by the normal
153 command.
154
155 For example if the normal command that will be executed
156 is 'dart file.dart' and you specify special command
157 'python -u valgrind.py @ suffix' the final command will be
158 'python -u valgrind.py dart file.dart suffix'""");
159
160 parser.addOption('dart', help: 'Path to dart executable');
161 parser.addOption('drt', help: 'Path to content shell executable');
162 parser.addOption('dartium', help: 'Path to Dartium Chrome executable');
163
164 print(parser.usage);
165 }
OLDNEW
« no previous file with comments | « packages/args/codereview.settings ('k') | packages/args/lib/args.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698