| 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 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, ie, firefox, opera, none (compile only)), | 77 safari, ie9, 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)''', | 80 (only valid with the following runtimes: none)''', |
| 81 ['-c', '--compiler'], | 81 ['-c', '--compiler'], |
| 82 ['none', 'dart2dart', 'dart2js', 'dartc'], | 82 ['none', 'dart2dart', 'dart2js', 'dartc'], |
| 83 'none'), | 83 'none'), |
| 84 new _TestOptionSpecification( | 84 new _TestOptionSpecification( |
| 85 'runtime', | 85 'runtime', |
| 86 '''Where the tests should be run. | 86 '''Where the tests should be run. |
| 87 vm: Run Dart code on the standalone dart vm. | 87 vm: Run Dart code on the standalone dart vm. |
| 88 | 88 |
| 89 d8: Run JavaScript from the command line using v8. | 89 d8: Run JavaScript from the command line using v8. |
| 90 | 90 |
| 91 jsshell: Run JavaScript from the command line using firefox js-shell. | 91 jsshell: Run JavaScript from the command line using firefox js-shell. |
| 92 | 92 |
| 93 drt: Run Dart or JavaScript in the headless version of Chrome, | 93 drt: Run Dart or JavaScript in the headless version of Chrome, |
| 94 DumpRenderTree. | 94 DumpRenderTree. |
| 95 | 95 |
| 96 dartium: Run Dart or JavaScript in Dartium. | 96 dartium: Run Dart or JavaScript in Dartium. |
| 97 | 97 |
| 98 [ff | chrome | safari | ie | opera]: Run JavaScript in the specified | 98 [ff | chrome | safari | ie9 | opera]: Run JavaScript in the specified |
| 99 browser. | 99 browser. |
| 100 | 100 |
| 101 none: No runtime, compile only (for example, used for dartc static analysis | 101 none: No runtime, compile only (for example, used for dartc static analysis |
| 102 tests).''', | 102 tests).''', |
| 103 ['-r', '--runtime'], | 103 ['-r', '--runtime'], |
| 104 ['vm', 'd8', 'jsshell', 'drt', 'dartium', 'ff', 'firefox', | 104 ['vm', 'd8', 'jsshell', 'drt', 'dartium', 'ff', 'firefox', |
| 105 'chrome', 'safari', 'ie', 'opera', 'none'], | 105 'chrome', 'safari', 'ie9', 'opera', 'none'], |
| 106 'vm'), | 106 'vm'), |
| 107 new _TestOptionSpecification( | 107 new _TestOptionSpecification( |
| 108 'arch', | 108 'arch', |
| 109 'The architecture to run tests for', | 109 'The architecture to run tests for', |
| 110 ['-a', '--arch'], | 110 ['-a', '--arch'], |
| 111 ['all', 'ia32', 'x64', 'simarm'], | 111 ['all', 'ia32', 'x64', 'simarm'], |
| 112 'ia32'), | 112 'ia32'), |
| 113 new _TestOptionSpecification( | 113 new _TestOptionSpecification( |
| 114 'system', | 114 'system', |
| 115 'The operating system to run tests on', | 115 'The operating system to run tests on', |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 bool _isValidConfig(Map config) { | 391 bool _isValidConfig(Map config) { |
| 392 bool isValid = true; | 392 bool isValid = true; |
| 393 List<String> validRuntimes; | 393 List<String> validRuntimes; |
| 394 switch (config['compiler']) { | 394 switch (config['compiler']) { |
| 395 case 'dart2js': | 395 case 'dart2js': |
| 396 // Note: by adding 'none' as a configuration, if the user | 396 // Note: by adding 'none' as a configuration, if the user |
| 397 // runs test.py -c dart2js -r drt,none the dart2js_none and | 397 // runs test.py -c dart2js -r drt,none the dart2js_none and |
| 398 // dart2js_drt will be duplicating work. If later we don't need 'none' | 398 // dart2js_drt will be duplicating work. If later we don't need 'none' |
| 399 // with dart2js, we should remove it from here. | 399 // with dart2js, we should remove it from here. |
| 400 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', | 400 validRuntimes = const ['d8', 'jsshell', 'drt', 'none', 'dartium', |
| 401 'ff', 'chrome', 'safari', 'ie', 'opera']; | 401 'ff', 'chrome', 'safari', 'ie9', 'opera']; |
| 402 break; | 402 break; |
| 403 case 'dartc': | 403 case 'dartc': |
| 404 validRuntimes = const ['none']; | 404 validRuntimes = const ['none']; |
| 405 break; | 405 break; |
| 406 case 'none': | 406 case 'none': |
| 407 case 'dart2dart': | 407 case 'dart2dart': |
| 408 validRuntimes = const ['vm', 'drt', 'dartium']; | 408 validRuntimes = const ['vm', 'drt', 'dartium']; |
| 409 break; | 409 break; |
| 410 } | 410 } |
| 411 if (!Contains(config['runtime'], validRuntimes)) { | 411 if (!Contains(config['runtime'], validRuntimes)) { |
| 412 isValid = false; | 412 isValid = false; |
| 413 print("Warning: combination of ${config['compiler']} and " | 413 print("Warning: combination of ${config['compiler']} and " |
| 414 "${config['runtime']} is invalid. Skipping this combination."); | 414 "${config['runtime']} is invalid. Skipping this combination."); |
| 415 } | 415 } |
| 416 if (config['runtime'] == 'ie' && | 416 if (config['runtime'] == 'ie9' && |
| 417 Platform.operatingSystem != 'windows') { | 417 Platform.operatingSystem != 'windows') { |
| 418 isValid = false; | 418 isValid = false; |
| 419 print("Warning cannot run Internet Explorer on non-Windows operating" | 419 print("Warning cannot run Internet Explorer on non-Windows operating" |
| 420 " system."); | 420 " system."); |
| 421 } | 421 } |
| 422 if (config['shard'] < 1 || config['shard'] > config['shards']) { | 422 if (config['shard'] < 1 || config['shard'] > config['shards']) { |
| 423 isValid = false; | 423 isValid = false; |
| 424 print("Error: shard index is ${config['shard']} out of " | 424 print("Error: shard index is ${config['shard']} out of " |
| 425 "${config['shards']} shards"); | 425 "${config['shards']} shards"); |
| 426 } | 426 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (configuration['mode'] == 'debug') { | 553 if (configuration['mode'] == 'debug') { |
| 554 timeout *= 8; | 554 timeout *= 8; |
| 555 } | 555 } |
| 556 if (configuration['host_checked']) { | 556 if (configuration['host_checked']) { |
| 557 timeout *= 16; | 557 timeout *= 16; |
| 558 } | 558 } |
| 559 if (configuration['checked']) { | 559 if (configuration['checked']) { |
| 560 timeout *= 2; | 560 timeout *= 2; |
| 561 } | 561 } |
| 562 if (Contains(configuration['runtime'], | 562 if (Contains(configuration['runtime'], |
| 563 const ['ie', 'ff', 'chrome', 'safari', 'opera'])) { | 563 const ['ie9', 'ff', 'chrome', 'safari', 'opera'])) { |
| 564 timeout *= 8; // Allow additional time for browser testing to run. | 564 timeout *= 8; // Allow additional time for browser testing to run. |
| 565 } | 565 } |
| 566 break; | 566 break; |
| 567 default: | 567 default: |
| 568 if (configuration['mode'] == 'debug') { | 568 if (configuration['mode'] == 'debug') { |
| 569 timeout *= 2; | 569 timeout *= 2; |
| 570 } | 570 } |
| 571 if (Contains(configuration['runtime'], const ['drt', 'dartium'])) { | 571 if (Contains(configuration['runtime'], const ['drt', 'dartium'])) { |
| 572 timeout *= 4; // Allow additional time for browser testing to run. | 572 timeout *= 4; // Allow additional time for browser testing to run. |
| 573 } | 573 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 return option; | 647 return option; |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 print('Unknown test option $name'); | 650 print('Unknown test option $name'); |
| 651 exit(1); | 651 exit(1); |
| 652 } | 652 } |
| 653 | 653 |
| 654 | 654 |
| 655 List<_TestOptionSpecification> _options; | 655 List<_TestOptionSpecification> _options; |
| 656 } | 656 } |
| OLD | NEW |