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

Side by Side Diff: tools/testing/dart/test_options.dart

Issue 21001003: test.py: First step towards support of caching dart2js compilations across runtimes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library test_options_parser; 5 library test_options_parser;
6 6
7 import "dart:io"; 7 import "dart:io";
8 import "dart:math"; 8 import "dart:math";
9 import "drt_updater.dart"; 9 import "drt_updater.dart";
10 import "test_suite.dart"; 10 import "test_suite.dart";
(...skipping 21 matching lines...) Expand all
32 List<String> keys; 32 List<String> keys;
33 List<String> values; 33 List<String> values;
34 var defaultValue; 34 var defaultValue;
35 String type; 35 String type;
36 } 36 }
37 37
38 /** 38 /**
39 * Parser of test options. 39 * Parser of test options.
40 */ 40 */
41 class TestOptionsParser { 41 class TestOptionsParser {
42 String specialCommandHelp =
43 """
44 Special command support. Wraps the command line in
45 a special command. The special command should contain
46 an '@' character which will be replaced by the normal
47 command executable.
48
49 For example if the normal command line that will be executed
50 is 'dart file.dart' and you specify special command
51 'python -u valgrind.py @ suffix' the final command will be
52 'python -u valgrind.py dart suffix file.dart'""";
53
54 /** 42 /**
55 * Creates a test options parser initialized with the known options. 43 * Creates a test options parser initialized with the known options.
56 */ 44 */
57 TestOptionsParser() { 45 TestOptionsParser() {
58 _options = 46 _options =
59 [ new _TestOptionSpecification( 47 [ new _TestOptionSpecification(
60 'mode', 48 'mode',
61 'Mode in which to run the tests', 49 'Mode in which to run the tests',
62 ['-m', '--mode'], 50 ['-m', '--mode'],
63 ['all', 'debug', 'release'], 51 ['all', 'debug', 'release'],
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 false, 209 false,
222 'bool'), 210 'bool'),
223 new _TestOptionSpecification( 211 new _TestOptionSpecification(
224 'list', 212 'list',
225 'List tests only, do not run them', 213 'List tests only, do not run them',
226 ['--list'], 214 ['--list'],
227 [], 215 [],
228 false, 216 false,
229 'bool'), 217 'bool'),
230 new _TestOptionSpecification( 218 new _TestOptionSpecification(
231 'valgrind',
232 'Run tests through valgrind',
233 ['--valgrind'],
234 [],
235 false,
236 'bool'),
237 new _TestOptionSpecification(
238 'special-command',
239 specialCommandHelp,
240 ['--special-command'],
241 [],
242 ''),
243 new _TestOptionSpecification(
244 'time', 219 'time',
245 'Print timing information after running tests', 220 'Print timing information after running tests',
246 ['--time'], 221 ['--time'],
247 [], 222 [],
248 false, 223 false,
249 'bool'), 224 'bool'),
250 new _TestOptionSpecification( 225 new _TestOptionSpecification(
251 'dart', 226 'dart',
252 'Path to dart executable', 227 'Path to dart executable',
253 ['--dart'], 228 ['--dart'],
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 * into a list of configurations with exactly one value per key. 548 * into a list of configurations with exactly one value per key.
574 */ 549 */
575 List<Map> _expandConfigurations(Map configuration) { 550 List<Map> _expandConfigurations(Map configuration) {
576 // Expand the pseudo-values such as 'all'. 551 // Expand the pseudo-values such as 'all'.
577 if (configuration['arch'] == 'all') { 552 if (configuration['arch'] == 'all') {
578 configuration['arch'] = 'ia32,x64,simarm,simmips'; 553 configuration['arch'] = 'ia32,x64,simarm,simmips';
579 } 554 }
580 if (configuration['mode'] == 'all') { 555 if (configuration['mode'] == 'all') {
581 configuration['mode'] = 'debug,release'; 556 configuration['mode'] = 'debug,release';
582 } 557 }
583 if (configuration['valgrind']) {
584 // TODO(ager): Get rid of this when there is only one checkout and
585 // we don't have to special case for the runtime checkout.
586 File valgrindFile = new File('runtime/tools/valgrind.py');
587 if (!valgrindFile.existsSync()) {
588 valgrindFile = new File('../runtime/tools/valgrind.py');
589 }
590 String valgrind = valgrindFile.fullPathSync();
591 configuration['special-command'] = 'python -u $valgrind @';
592 }
593 558
594 // Use verbose progress indication for verbose output unless buildbot 559 // Use verbose progress indication for verbose output unless buildbot
595 // progress indication is requested. 560 // progress indication is requested.
596 if (configuration['verbose'] && configuration['progress'] != 'buildbot') { 561 if (configuration['verbose'] && configuration['progress'] != 'buildbot') {
597 configuration['progress'] = 'verbose'; 562 configuration['progress'] = 'verbose';
598 } 563 }
599 564
600 // Create the artificial negative options that test status files 565 // Create the artificial negative options that test status files
601 // expect. 566 // expect.
602 configuration['unchecked'] = !configuration['checked']; 567 configuration['unchecked'] = !configuration['checked'];
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return option; 751 return option;
787 } 752 }
788 } 753 }
789 print('Unknown test option $name'); 754 print('Unknown test option $name');
790 exit(1); 755 exit(1);
791 } 756 }
792 757
793 758
794 List<_TestOptionSpecification> _options; 759 List<_TestOptionSpecification> _options;
795 } 760 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698