Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 '''Specify any compilation step (if needed). | 67 '''Specify any compilation step (if needed). |
| 68 | 68 |
| 69 none: Do not compile the Dart code (run native Dart code on the VM). | 69 none: Do not compile the Dart code (run native Dart code on the VM). |
| 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, chromeOnAndroid, |
| 78 none (compile only)), | |
| 78 | 79 |
| 79 dartc: Perform static analysis on Dart code by running dartc. | 80 dartc: Perform static analysis on Dart code by running dartc. |
| 80 (only valid with the following runtimes: none), | 81 (only valid with the following runtimes: none), |
| 81 | 82 |
| 82 dartanalyzer: Perform static analysis on Dart code by running the analyzer. | 83 dartanalyzer: Perform static analysis on Dart code by running the analyzer. |
| 83 (only valid with the following runtimes: none)''', | 84 (only valid with the following runtimes: none)''', |
| 84 ['-c', '--compiler'], | 85 ['-c', '--compiler'], |
| 85 ['none', 'dart2dart', 'dart2js', 'dartc', 'dartanalyzer'], | 86 ['none', 'dart2dart', 'dart2js', 'dartc', 'dartanalyzer'], |
| 86 'none'), | 87 'none'), |
| 87 new _TestOptionSpecification( | 88 new _TestOptionSpecification( |
| 88 'runtime', | 89 'runtime', |
| 89 '''Where the tests should be run. | 90 '''Where the tests should be run. |
| 90 vm: Run Dart code on the standalone dart vm. | 91 vm: Run Dart code on the standalone dart vm. |
| 91 | 92 |
| 92 d8: Run JavaScript from the command line using v8. | 93 d8: Run JavaScript from the command line using v8. |
| 93 | 94 |
| 94 jsshell: Run JavaScript from the command line using firefox js-shell. | 95 jsshell: Run JavaScript from the command line using firefox js-shell. |
| 95 | 96 |
| 96 drt: Run Dart or JavaScript in the headless version of Chrome, | 97 drt: Run Dart or JavaScript in the headless version of Chrome, |
| 97 DumpRenderTree. | 98 DumpRenderTree. |
| 98 | 99 |
| 99 dartium: Run Dart or JavaScript in Dartium. | 100 dartium: Run Dart or JavaScript in Dartium. |
| 100 | 101 |
| 101 [ff | chrome | safari | ie9 | ie10 | opera]: Run JavaScript in the specified | 102 [ff | chrome | safari | ie9 | ie10 | opera | chromeOnAndroid]: |
| 102 browser. | 103 Run JavaScript in the specified browser. |
| 103 | 104 |
| 104 none: No runtime, compile only (for example, used for dartc static analysis | 105 none: No runtime, compile only (for example, used for dartc static analysis |
| 105 tests).''', | 106 tests).''', |
| 106 ['-r', '--runtime'], | 107 ['-r', '--runtime'], |
| 107 ['vm', 'd8', 'jsshell', 'drt', 'dartium', 'ff', 'firefox', | 108 ['vm', 'd8', 'jsshell', 'drt', 'dartium', 'ff', 'firefox', |
| 108 'chrome', 'safari', 'ie9', 'ie10', 'opera', 'none'], | 109 'chrome', 'safari', 'ie9', 'ie10', 'opera', 'chromeOnAndroid', 'n one'], |
| 109 'vm'), | 110 'vm'), |
| 110 new _TestOptionSpecification( | 111 new _TestOptionSpecification( |
| 111 'arch', | 112 'arch', |
| 112 'The architecture to run tests for', | 113 'The architecture to run tests for', |
| 113 ['-a', '--arch'], | 114 ['-a', '--arch'], |
| 114 ['all', 'ia32', 'x64', 'simarm', 'simmips'], | 115 ['all', 'ia32', 'x64', 'simarm', 'simmips'], |
| 115 'ia32'), | 116 'ia32'), |
| 116 new _TestOptionSpecification( | 117 new _TestOptionSpecification( |
| 117 'system', | 118 'system', |
| 118 'The operating system to run tests on', | 119 'The operating system to run tests on', |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 false, | 303 false, |
| 303 'bool' | 304 'bool' |
| 304 ), | 305 ), |
| 305 new _TestOptionSpecification( | 306 new _TestOptionSpecification( |
| 306 'use_browser_controller', | 307 'use_browser_controller', |
| 307 'Use the new selenium replacement browser-controller.', | 308 'Use the new selenium replacement browser-controller.', |
| 308 ['--use_browser_controller'], | 309 ['--use_browser_controller'], |
| 309 [], | 310 [], |
| 310 false, | 311 false, |
| 311 'bool' | 312 'bool' |
| 312 ),]; | 313 ), |
| 314 new _TestOptionSpecification( | |
| 315 'local_ip', | |
| 316 'IP address the http servers should listen on.' | |
| 317 'This address is also used for browsers to connect.', | |
| 318 ['--local_ip'], | |
| 319 [], | |
| 320 '127.0.0.1'),]; | |
|
ricow1
2013/05/21 18:30:43
you actually default to 0.0.0.0 in the http server
kustermann
2013/05/22 09:30:58
I'm aware and there is a reason for it:
- We don't
| |
| 313 } | 321 } |
| 314 | 322 |
| 315 | 323 |
| 316 /** | 324 /** |
| 317 * Parse a list of strings as test options. | 325 * Parse a list of strings as test options. |
| 318 * | 326 * |
| 319 * Returns a list of configurations in which to run the | 327 * Returns a list of configurations in which to run the |
| 320 * tests. Configurations are maps mapping from option keys to | 328 * tests. Configurations are maps mapping from option keys to |
| 321 * values. When encountering the first non-option string, the rest | 329 * values. When encountering the first non-option string, the rest |
| 322 * of the arguments are stored in the returned Map under the 'rest' | 330 * of the arguments are stored in the returned Map under the 'rest' |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 bool isValid = true; | 448 bool isValid = true; |
| 441 List<String> validRuntimes; | 449 List<String> validRuntimes; |
| 442 switch (config['compiler']) { | 450 switch (config['compiler']) { |
| 443 case 'dart2js': | 451 case 'dart2js': |
| 444 // Note: by adding 'none' as a configuration, if the user | 452 // Note: by adding 'none' as a configuration, if the user |
| 445 // runs test.py -c dart2js -r drt,none the dart2js_none and | 453 // runs test.py -c dart2js -r drt,none the dart2js_none and |
| 446 // dart2js_drt will be duplicating work. If later we don't need 'none' | 454 // dart2js_drt will be duplicating work. If later we don't need 'none' |
| 447 // with dart2js, we should remove it from here. | 455 // with dart2js, we should remove it from here. |
| 448 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', | 456 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', |
| 449 'ff', 'chrome', 'safari', 'ie9', 'ie10', | 457 'ff', 'chrome', 'safari', 'ie9', 'ie10', |
| 450 'opera']; | 458 'opera', 'chromeOnAndroid']; |
| 451 break; | 459 break; |
| 452 case 'dartc': | 460 case 'dartc': |
| 453 case 'dartanalyzer': | 461 case 'dartanalyzer': |
| 454 validRuntimes = const ['none']; | 462 validRuntimes = const ['none']; |
| 455 break; | 463 break; |
| 456 case 'none': | 464 case 'none': |
| 457 case 'dart2dart': | 465 case 'dart2dart': |
| 458 validRuntimes = const ['vm', 'drt', 'dartium']; | 466 validRuntimes = const ['vm', 'drt', 'dartium']; |
| 459 break; | 467 break; |
| 460 } | 468 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 timeout = 60; | 616 timeout = 60; |
| 609 if (configuration['mode'] == 'debug') { | 617 if (configuration['mode'] == 'debug') { |
| 610 timeout *= 8; | 618 timeout *= 8; |
| 611 } | 619 } |
| 612 if (configuration['host_checked']) { | 620 if (configuration['host_checked']) { |
| 613 timeout *= 16; | 621 timeout *= 16; |
| 614 } | 622 } |
| 615 if (configuration['checked']) { | 623 if (configuration['checked']) { |
| 616 timeout *= 2; | 624 timeout *= 2; |
| 617 } | 625 } |
| 618 | |
| 619 break; | 626 break; |
| 620 default: | 627 default: |
| 621 if (configuration['mode'] == 'debug') { | 628 if (configuration['mode'] == 'debug') { |
| 622 timeout *= 2; | 629 timeout *= 2; |
| 623 } | 630 } |
| 624 if (const ['drt', 'dartium'].contains(configuration['runtime'])) { | 631 if (const ['drt', 'dartium'].contains(configuration['runtime'])) { |
| 625 timeout *= 4; // Allow additional time for browser testing to run. | 632 timeout *= 4; // Allow additional time for browser testing to run. |
| 626 } | 633 } |
| 627 break; | 634 break; |
| 628 } | 635 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 return option; | 707 return option; |
| 701 } | 708 } |
| 702 } | 709 } |
| 703 print('Unknown test option $name'); | 710 print('Unknown test option $name'); |
| 704 exit(1); | 711 exit(1); |
| 705 } | 712 } |
| 706 | 713 |
| 707 | 714 |
| 708 List<_TestOptionSpecification> _options; | 715 List<_TestOptionSpecification> _options; |
| 709 } | 716 } |
| OLD | NEW |