Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 (only valid with the following runtimes: vm, drt) | 70 (only valid with the following runtimes: vm, drt) |
| 71 | 71 |
| 72 dart2dart: Compile Dart code to Dart code | 72 dart2dart: Compile Dart code to Dart code |
| 73 (only valid with the following runtimes: vm, drt) | 73 (only valid with the following runtimes: vm, drt) |
| 74 | 74 |
| 75 dart2js: Compile dart code to JavaScript by running dart2js. | 75 dart2js: Compile dart code to JavaScript by running dart2js. |
| 76 (only valid with the following runtimes: d8, drt, chrome, | 76 (only valid with the following runtimes: d8, drt, chrome, |
| 77 safari, ie9, ie10, firefox, opera, none (compile only)), | 77 safari, ie9, ie10, firefox, opera, none (compile only)), |
| 78 | 78 |
| 79 dartc: Perform static analysis on Dart code by running dartc. | 79 dartc: Perform static analysis on Dart code by running dartc. |
| 80 (only valid with the following runtimes: none), | |
| 81 | |
| 82 new_analyzer: Perform static analysis on Dart code by running the analyzer. | |
| 80 (only valid with the following runtimes: none)''', | 83 (only valid with the following runtimes: none)''', |
| 81 ['-c', '--compiler'], | 84 ['-c', '--compiler'], |
| 82 ['none', 'dart2dart', 'dart2js', 'dartc'], | 85 ['none', 'dart2dart', 'dart2js', 'dartc', 'new_analyzer'], |
| 83 'none'), | 86 'none'), |
| 84 new _TestOptionSpecification( | 87 new _TestOptionSpecification( |
| 85 'runtime', | 88 'runtime', |
| 86 '''Where the tests should be run. | 89 '''Where the tests should be run. |
| 87 vm: Run Dart code on the standalone dart vm. | 90 vm: Run Dart code on the standalone dart vm. |
| 88 | 91 |
| 89 d8: Run JavaScript from the command line using v8. | 92 d8: Run JavaScript from the command line using v8. |
| 90 | 93 |
| 91 jsshell: Run JavaScript from the command line using firefox js-shell. | 94 jsshell: Run JavaScript from the command line using firefox js-shell. |
| 92 | 95 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 case 'dart2js': | 428 case 'dart2js': |
| 426 // Note: by adding 'none' as a configuration, if the user | 429 // Note: by adding 'none' as a configuration, if the user |
| 427 // runs test.py -c dart2js -r drt,none the dart2js_none and | 430 // runs test.py -c dart2js -r drt,none the dart2js_none and |
| 428 // dart2js_drt will be duplicating work. If later we don't need 'none' | 431 // dart2js_drt will be duplicating work. If later we don't need 'none' |
| 429 // with dart2js, we should remove it from here. | 432 // with dart2js, we should remove it from here. |
| 430 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', | 433 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', |
| 431 'ff', 'chrome', 'safari', 'ie9', 'ie10', | 434 'ff', 'chrome', 'safari', 'ie9', 'ie10', |
| 432 'opera']; | 435 'opera']; |
| 433 break; | 436 break; |
| 434 case 'dartc': | 437 case 'dartc': |
| 438 case 'new_analyzer': | |
| 435 validRuntimes = const ['none']; | 439 validRuntimes = const ['none']; |
| 436 break; | 440 break; |
| 437 case 'none': | 441 case 'none': |
| 438 case 'dart2dart': | 442 case 'dart2dart': |
| 439 validRuntimes = const ['vm', 'drt', 'dartium']; | 443 validRuntimes = const ['vm', 'drt', 'dartium']; |
| 440 break; | 444 break; |
| 441 } | 445 } |
| 442 if (!validRuntimes.contains(config['runtime'])) { | 446 if (!validRuntimes.contains(config['runtime'])) { |
| 443 isValid = false; | 447 isValid = false; |
| 444 print("Warning: combination of ${config['compiler']} and " | 448 print("Warning: combination of ${config['compiler']} and " |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 configuration['unchecked'] = !configuration['checked']; | 505 configuration['unchecked'] = !configuration['checked']; |
| 502 configuration['host_unchecked'] = !configuration['host_checked']; | 506 configuration['host_unchecked'] = !configuration['host_checked']; |
| 503 | 507 |
| 504 configuration['unminified'] = !configuration['minified']; | 508 configuration['unminified'] = !configuration['minified']; |
| 505 | 509 |
| 506 String runtime = configuration['runtime']; | 510 String runtime = configuration['runtime']; |
| 507 if (runtime == 'firefox') { | 511 if (runtime == 'firefox') { |
| 508 configuration['runtime'] == 'ff'; | 512 configuration['runtime'] == 'ff'; |
| 509 } | 513 } |
| 510 | 514 |
| 515 String compiler = configuration['compiler']; | |
| 511 configuration['browser'] = TestUtils.isBrowserRuntime(runtime); | 516 configuration['browser'] = TestUtils.isBrowserRuntime(runtime); |
| 512 | 517 configuration['analyzer'] = TestUtils.isCommandLineAnalyzer(compiler); |
| 518 | |
| 519 print("analyzer"); | |
| 520 print(compiler); | |
| 521 print(configuration['analyzer']); | |
|
kustermann
2013/03/12 17:55:23
Left over 'print'!
ricow1
2013/03/12 18:06:06
Done.
| |
| 513 // Set the javascript command line flag for less verbose status files. | 522 // Set the javascript command line flag for less verbose status files. |
| 514 configuration['jscl'] = TestUtils.isJsCommandLineRuntime(runtime); | 523 configuration['jscl'] = TestUtils.isJsCommandLineRuntime(runtime); |
| 515 | 524 |
| 516 // Expand the test selectors into a suite name and a simple | 525 // Expand the test selectors into a suite name and a simple |
| 517 // regular expressions to be used on the full path of a test file | 526 // regular expressions to be used on the full path of a test file |
| 518 // in that test suite. If no selectors are explicitly given use | 527 // in that test suite. If no selectors are explicitly given use |
| 519 // the default suite patterns. | 528 // the default suite patterns. |
| 520 var selectors = configuration['selectors']; | 529 var selectors = configuration['selectors']; |
| 521 if (selectors is !Map) { | 530 if (selectors is !Map) { |
| 522 if (selectors == null) { | 531 if (selectors == null) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 if (updater != null) { | 579 if (updater != null) { |
| 571 updater.update(); | 580 updater.update(); |
| 572 } | 581 } |
| 573 } | 582 } |
| 574 | 583 |
| 575 // Adjust default timeout based on mode, compiler, and sometimes runtime. | 584 // Adjust default timeout based on mode, compiler, and sometimes runtime. |
| 576 if (configuration['timeout'] == -1) { | 585 if (configuration['timeout'] == -1) { |
| 577 var timeout = 60; | 586 var timeout = 60; |
| 578 switch (configuration['compiler']) { | 587 switch (configuration['compiler']) { |
| 579 case 'dartc': | 588 case 'dartc': |
| 589 case 'new_analyzer': | |
| 580 timeout *= 4; | 590 timeout *= 4; |
| 581 break; | 591 break; |
| 582 case 'dart2js': | 592 case 'dart2js': |
| 583 // TODO(ahe): Restore the timeout of 30 seconds when dart2js | 593 // TODO(ahe): Restore the timeout of 30 seconds when dart2js |
| 584 // compile-time performance has improved. | 594 // compile-time performance has improved. |
| 585 timeout = 60; | 595 timeout = 60; |
| 586 if (configuration['mode'] == 'debug') { | 596 if (configuration['mode'] == 'debug') { |
| 587 timeout *= 8; | 597 timeout *= 8; |
| 588 } | 598 } |
| 589 if (configuration['host_checked']) { | 599 if (configuration['host_checked']) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 return option; | 694 return option; |
| 685 } | 695 } |
| 686 } | 696 } |
| 687 print('Unknown test option $name'); | 697 print('Unknown test option $name'); |
| 688 exit(1); | 698 exit(1); |
| 689 } | 699 } |
| 690 | 700 |
| 691 | 701 |
| 692 List<_TestOptionSpecification> _options; | 702 List<_TestOptionSpecification> _options; |
| 693 } | 703 } |
| OLD | NEW |