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

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

Issue 10809069: dart2dart compiler support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 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
« no previous file with comments | « tests/utils/utils.status ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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("drt_updater.dart"); 8 #import("drt_updater.dart");
9 #import("test_suite.dart"); 9 #import("test_suite.dart");
10 10
(...skipping 16 matching lines...) Expand all
27 this.defaultValue, 27 this.defaultValue,
28 [type = 'string']) : this.type = type; 28 [type = 'string']) : this.type = type;
29 String name; 29 String name;
30 String description; 30 String description;
31 List<String> keys; 31 List<String> keys;
32 List<String> values; 32 List<String> values;
33 var defaultValue; 33 var defaultValue;
34 String type; 34 String type;
35 } 35 }
36 36
37
38 /** 37 /**
39 * Parser of test options. 38 * Parser of test options.
40 */ 39 */
41 class TestOptionsParser { 40 class TestOptionsParser {
42 String specialCommandHelp = 41 String specialCommandHelp =
43 """ 42 """
44 Special command support. Wraps the command line in 43 Special command support. Wraps the command line in
45 a special command. The special command should contain 44 a special command. The special command should contain
46 an '@' character which will be replaced by the normal 45 an '@' character which will be replaced by the normal
47 command. 46 command.
(...skipping 14 matching lines...) Expand all
62 ['-m', '--mode'], 61 ['-m', '--mode'],
63 ['all', 'debug', 'release'], 62 ['all', 'debug', 'release'],
64 'debug'), 63 'debug'),
65 new _TestOptionSpecification( 64 new _TestOptionSpecification(
66 'compiler', 65 'compiler',
67 '''Specify any compilation step (if needed). 66 '''Specify any compilation step (if needed).
68 67
69 none: Do not compile the Dart code (run native Dart code on the VM). 68 none: Do not compile the Dart code (run native Dart code on the VM).
70 (only valid with the following runtimes: vm, drt) 69 (only valid with the following runtimes: vm, drt)
71 70
71 dart2dart: Compile Dart code to Dart code
72 (only valid with the following runtimes: vm, drt)
73
72 dart2js: Compile dart code to JavaScript by running dart2js (leg). 74 dart2js: Compile dart code to JavaScript by running dart2js (leg).
73 (only valid with the following runtimes: same as frog) 75 (only valid with the following runtimes: same as frog)
74 76
75 dartc: Perform static analysis on Dart code by running dartc. 77 dartc: Perform static analysis on Dart code by running dartc.
76 (only valid with the following runtimes: none) 78 (only valid with the following runtimes: none)
77 79
78 frog: (DEPRECATED) Compile dart code to JavaScript by running the 80 frog: (DEPRECATED) Compile dart code to JavaScript by running the
79 frog compiler. (only valid with the following runtimes: d8, 81 frog compiler. (only valid with the following runtimes: d8,
80 drt, chrome, safari, ie, firefox, opera, none (compile only))''', 82 drt, chrome, safari, ie, firefox, opera, none (compile only))''',
81 ['-c', '--compiler'], 83 ['-c', '--compiler'],
82 ['none', 'frog', 'dart2js', 'dartc'], 84 ['none', 'dart2dart', 'frog', 'dart2js', 'dartc'],
83 'none'), 85 'none'),
84 new _TestOptionSpecification( 86 new _TestOptionSpecification(
85 'runtime', 87 'runtime',
86 '''Where the tests should be run. 88 '''Where the tests should be run.
87 vm: Run Dart code on the standalone dart vm. 89 vm: Run Dart code on the standalone dart vm.
88 90
89 d8: Run JavaScript from the command line using v8. 91 d8: Run JavaScript from the command line using v8.
90 92
91 drt: Run Dart or JavaScript in the headless version of Chrome, 93 drt: Run Dart or JavaScript in the headless version of Chrome,
92 DumpRenderTree. 94 DumpRenderTree.
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 List<Map> result = expandedConfigs.filter(_isValidConfig); 383 List<Map> result = expandedConfigs.filter(_isValidConfig);
382 return result.isEmpty() ? null : result; 384 return result.isEmpty() ? null : result;
383 } 385 }
384 386
385 /** 387 /**
386 * Determine if a particular configuration has a valid combination of compiler 388 * Determine if a particular configuration has a valid combination of compiler
387 * and runtime elements. 389 * and runtime elements.
388 */ 390 */
389 bool _isValidConfig(Map config) { 391 bool _isValidConfig(Map config) {
390 bool isValid = true; 392 bool isValid = true;
391 switch (config['compiler']) { 393 List<String> validRuntimes;
392 case 'frog': 394 switch (config['compiler']) {
393 case 'dart2js': 395 case 'frog':
394 // Note: by adding 'none' as a configuration, if the user 396 case 'dart2js':
395 // runs test.py -c dart2js -r drt,none the dart2js_none and 397 // Note: by adding 'none' as a configuration, if the user
396 // dart2js_drt will be duplicating work. If later we don't need 'none' 398 // runs test.py -c dart2js -r drt,none the dart2js_none and
397 // with dart2js, we should remove it from here. 399 // dart2js_drt will be duplicating work. If later we don't need 'none'
398 isValid = (const ['d8', 'drt', 'dartium', 'ff', 400 // with dart2js, we should remove it from here.
399 'chrome', 'safari', 'ie', 'opera', 401 validRuntimes = const ['d8', 'drt', 'none', 'dartium',
400 'none']).indexOf(config['runtime']) >= 0; 402 'ff', 'chrome', 'safari', 'ie', 'opera'];
401 break; 403 break;
402 case 'dartc': 404 case 'dartc':
403 isValid = config['runtime'] == 'none'; 405 validRuntimes = const ['none'];
404 break; 406 break;
405 case 'none': 407 case 'none':
406 isValid = (const ['vm', 'drt', 408 case 'dart2dart':
407 'dartium']).indexOf(config['runtime']) >= 0; 409 validRuntimes = const ['vm', 'drt', 'dartium'];
408 } 410 break;
409 if (!isValid) { 411 }
412 if (!Contains(config['runtime'], validRuntimes)) {
413 isValid = false;
410 print("Warning: combination of ${config['compiler']} and " 414 print("Warning: combination of ${config['compiler']} and "
411 "${config['runtime']} is invalid. Skipping this combination."); 415 "${config['runtime']} is invalid. Skipping this combination.");
412 } 416 }
413 if (config['runtime'] == 'ie' && 417 if (config['runtime'] == 'ie' &&
414 Platform.operatingSystem != 'windows') { 418 Platform.operatingSystem != 'windows') {
415 isValid = false; 419 isValid = false;
416 print("Warning cannot run Internet Explorer on non-Windows operating" 420 print("Warning cannot run Internet Explorer on non-Windows operating"
417 " system."); 421 " system.");
418 } 422 }
419 if (config['shard'] < 1 || config['shard'] > config['shards']) { 423 if (config['shard'] < 1 || config['shard'] > config['shards']) {
420 isValid = false; 424 isValid = false;
421 print("Error: shard index is ${config['shard']} out of " 425 print("Error: shard index is ${config['shard']} out of "
422 "${config['shards']} shards"); 426 "${config['shards']} shards");
423 } 427 }
424 if (config['runtime'] == 'dartium' && config['compiler'] == 'none' && 428 if (config['runtime'] == 'dartium' &&
429 Contains(config['compiler'], const ['none', 'dart2dart']) &&
425 config['checked']) { 430 config['checked']) {
426 // TODO(vsm): Set the DART_FLAGS environment appropriately when 431 // TODO(vsm): Set the DART_FLAGS environment appropriately when
427 // invoking Selenium to support checked mode. It's not clear 432 // invoking Selenium to support checked mode. It's not clear
428 // the current selenium API supports this. 433 // the current selenium API supports this.
429 isValid = false; 434 isValid = false;
430 print("Warning: checked mode is not yet supported for dartium tests."); 435 print("Warning: checked mode is not yet supported for dartium tests.");
431 } 436 }
432 return isValid; 437 return isValid;
433 } 438 }
434 439
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 timeout *= 4; 547 timeout *= 4;
543 break; 548 break;
544 case 'dart2js': 549 case 'dart2js':
545 case 'frog': 550 case 'frog':
546 if (configuration['mode'] == 'debug') { 551 if (configuration['mode'] == 'debug') {
547 timeout *= 8; 552 timeout *= 8;
548 } 553 }
549 if (configuration['host_checked']) { 554 if (configuration['host_checked']) {
550 timeout *= 16; 555 timeout *= 16;
551 } 556 }
552 if ((const ['ie', 'ff', 'chrome', 'safari', 557 if (Contains(configuration['runtime'],
553 'opera']).indexOf(configuration['runtime']) >= 0) { 558 const ['ie', 'ff', 'chrome', 'safari', 'opera'])) {
554 timeout *= 4; // Allow additional time for browser testing to run. 559 timeout *= 4; // Allow additional time for browser testing to run.
555 } 560 }
556 break; 561 break;
557 default: 562 default:
558 if (configuration['mode'] == 'debug') { 563 if (configuration['mode'] == 'debug') {
559 timeout *= 2; 564 timeout *= 2;
560 } 565 }
561 if ((const ['drt', 'dartium']).indexOf(configuration['runtime']) 566 if (Contains(configuration['runtime'], const ['drt', 'dartium'])) {
562 >= 0) {
563 timeout *= 4; // Allow additional time for browser testing to run. 567 timeout *= 4; // Allow additional time for browser testing to run.
564 } 568 }
565 break; 569 break;
566 } 570 }
567 configuration['timeout'] = timeout; 571 configuration['timeout'] = timeout;
568 } 572 }
569 573
570 return [configuration]; 574 return [configuration];
571 } 575 }
572 576
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 return option; 642 return option;
639 } 643 }
640 } 644 }
641 print('Unknown test option $name'); 645 print('Unknown test option $name');
642 exit(1); 646 exit(1);
643 } 647 }
644 648
645 649
646 List<_TestOptionSpecification> _options; 650 List<_TestOptionSpecification> _options;
647 } 651 }
OLDNEW
« no previous file with comments | « tests/utils/utils.status ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698