| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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:builtin"); | 8 #import("dart:builtin"); |
| 9 #import("drt_updater.dart"); | 9 #import("drt_updater.dart"); |
| 10 | 10 |
| 11 List<String> defaultTestSelectors = | 11 List<String> defaultTestSelectors = |
| 12 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', | 12 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', |
| 13 'isolate', 'vm', 'client', 'dartdoc', 'utils']; | 13 'isolate', 'vm', 'client', 'dartdoc', 'utils', 'pub']; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Specification of a single test option. | 16 * Specification of a single test option. |
| 17 * | 17 * |
| 18 * The name of the specification is used as the key for the option in | 18 * The name of the specification is used as the key for the option in |
| 19 * the Map returned from the [TestOptionParser] parse method. | 19 * the Map returned from the [TestOptionParser] parse method. |
| 20 */ | 20 */ |
| 21 class _TestOptionSpecification { | 21 class _TestOptionSpecification { |
| 22 _TestOptionSpecification(this.name, | 22 _TestOptionSpecification(this.name, |
| 23 this.description, | 23 this.description, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 frog: Compile dart code to JavaScript by running the frog compiler. | 71 frog: Compile dart code to JavaScript by running the frog compiler. |
| 72 (only valid with the following runtimes: d8, drt, chrome, safari, ie, | 72 (only valid with the following runtimes: d8, drt, chrome, safari, ie, |
| 73 firefox, opera, none (compile only)) | 73 firefox, opera, none (compile only)) |
| 74 | 74 |
| 75 dart2js: Compile dart code to JavaScript by running dart2js (leg). | 75 dart2js: Compile dart code to JavaScript by running dart2js (leg). |
| 76 (only valid with the following runtimes: same as frog) | 76 (only valid with the following runtimes: same as frog) |
| 77 | 77 |
| 78 dartc: Perform static analysis on Dart code by running dartc. | 78 dartc: Perform static analysis on Dart code by running dartc. |
| 79 (only valid with the following runtimes: none) | 79 (only valid with the following runtimes: none) |
| 80 | 80 |
| 81 frogsh: Compile dart code to JavaScript by running the frog compiler on | 81 frogsh: Compile dart code to JavaScript by running the frog compiler on |
| 82 node.js, and run the resulting JavaScript on the same instance of | 82 node.js, and run the resulting JavaScript on the same instance of |
| 83 node.js. | 83 node.js. |
| 84 (only valid with the following runtimes: same as frog)''', | 84 (only valid with the following runtimes: same as frog)''', |
| 85 ['-c', '--compiler'], | 85 ['-c', '--compiler'], |
| 86 ['none', 'frog', 'dart2js', 'dartc', 'frogsh'], | 86 ['none', 'frog', 'dart2js', 'dartc', 'frogsh'], |
| 87 'none'), | 87 'none'), |
| 88 new _TestOptionSpecification( | 88 new _TestOptionSpecification( |
| 89 'runtime', | 89 'runtime', |
| 90 '''Where the tests should be run. | 90 '''Where the tests should be run. |
| 91 vm: Run Dart code on the standalone dart vm. | 91 vm: Run Dart code on the standalone dart vm. |
| 92 | 92 |
| 93 d8: Run JavaScript from the command line using v8. | 93 d8: Run JavaScript from the command line using v8. |
| 94 | 94 |
| 95 drt: Run Dart or JavaScript in the headless version of Chrome, | 95 drt: Run Dart or JavaScript in the headless version of Chrome, |
| 96 DumpRenderTree. | 96 DumpRenderTree. |
| 97 | 97 |
| 98 ff or firefox: Run JavaScript in Firefox. | 98 ff or firefox: Run JavaScript in Firefox. |
| 99 | 99 |
| 100 chrome: Run JavaScript in Chrome. | 100 chrome: Run JavaScript in Chrome. |
| 101 | 101 |
| 102 safari: Run JavaScript in Safari. | 102 safari: Run JavaScript in Safari. |
| 103 | 103 |
| 104 ie: Run JavaScript in Internet Explorer. | 104 ie: Run JavaScript in Internet Explorer. |
| 105 | 105 |
| 106 opera: Run JavaScript in Opera. | 106 opera: Run JavaScript in Opera. |
| 107 | 107 |
| 108 none: No runtime, compile only (for example, used for dartc static analysis | 108 none: No runtime, compile only (for example, used for dartc static analysis |
| 109 tests).''', | 109 tests).''', |
| 110 ['-r', '--runtime'], | 110 ['-r', '--runtime'], |
| 111 ['vm', 'd8', 'drt', 'ff', 'firefox', 'chrome', | 111 ['vm', 'd8', 'drt', 'ff', 'firefox', 'chrome', |
| 112 'safari', 'ie', 'opera', 'none'], | 112 'safari', 'ie', 'opera', 'none'], |
| 113 'vm'), | 113 'vm'), |
| 114 new _TestOptionSpecification( | 114 new _TestOptionSpecification( |
| 115 'arch', | 115 'arch', |
| 116 'The architecture to run tests for', | 116 'The architecture to run tests for', |
| 117 ['-a', '--arch'], | 117 ['-a', '--arch'], |
| 118 ['all', 'ia32', 'x64', 'simarm'], | 118 ['all', 'ia32', 'x64', 'simarm'], |
| 119 'ia32'), | 119 'ia32'), |
| 120 new _TestOptionSpecification( | 120 new _TestOptionSpecification( |
| 121 'system', | 121 'system', |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 case 'dartc': | 394 case 'dartc': |
| 395 isValid = config['runtime'] == 'none'; | 395 isValid = config['runtime'] == 'none'; |
| 396 break; | 396 break; |
| 397 case 'none': | 397 case 'none': |
| 398 isValid = (const ['vm', 'drt']).indexOf(config['runtime']) >= 0; | 398 isValid = (const ['vm', 'drt']).indexOf(config['runtime']) >= 0; |
| 399 } | 399 } |
| 400 if (!isValid) { | 400 if (!isValid) { |
| 401 print("Warning: combination of ${config['compiler']} and " + | 401 print("Warning: combination of ${config['compiler']} and " + |
| 402 "${config['runtime']} is invalid. Skipping this combination."); | 402 "${config['runtime']} is invalid. Skipping this combination."); |
| 403 } | 403 } |
| 404 if (config['runtime'] == 'ie' && | 404 if (config['runtime'] == 'ie' && |
| 405 new Platform().operatingSystem() != 'windows') { | 405 new Platform().operatingSystem() != 'windows') { |
| 406 isValid = false; | 406 isValid = false; |
| 407 print("Warning cannot run Internet Explorer on non-Windows operating" + | 407 print("Warning cannot run Internet Explorer on non-Windows operating" + |
| 408 " system."); | 408 " system."); |
| 409 } | 409 } |
| 410 if (config['shard'] < 1 || config['shard'] > config['shards']) { | 410 if (config['shard'] < 1 || config['shard'] > config['shards']) { |
| 411 isValid = false; | 411 isValid = false; |
| 412 print("Error: shard index is ${config['shard']} out of " + | 412 print("Error: shard index is ${config['shard']} out of " + |
| 413 "${config['shards']} shards"); | 413 "${config['shards']} shards"); |
| 414 } | 414 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 // Expand the architectures. | 488 // Expand the architectures. |
| 489 if (configuration['arch'].contains(',')) { | 489 if (configuration['arch'].contains(',')) { |
| 490 return _expandHelper('arch', configuration); | 490 return _expandHelper('arch', configuration); |
| 491 } | 491 } |
| 492 | 492 |
| 493 // Expand modes. | 493 // Expand modes. |
| 494 if (configuration['mode'].contains(',')) { | 494 if (configuration['mode'].contains(',')) { |
| 495 return _expandHelper('mode', configuration); | 495 return _expandHelper('mode', configuration); |
| 496 } | 496 } |
| 497 | 497 |
| 498 // Expand compilers. | 498 // Expand compilers. |
| 499 if (configuration['compiler'].contains(',')) { | 499 if (configuration['compiler'].contains(',')) { |
| 500 return _expandHelper('compiler', configuration); | 500 return _expandHelper('compiler', configuration); |
| 501 } | 501 } |
| 502 | 502 |
| 503 // Expand runtimes. | 503 // Expand runtimes. |
| 504 var runtimes = configuration['runtime']; | 504 var runtimes = configuration['runtime']; |
| 505 if (runtimes.contains(',')) { | 505 if (runtimes.contains(',')) { |
| 506 return _expandHelper('runtime', configuration); | 506 return _expandHelper('runtime', configuration); |
| 507 } else { | 507 } else { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 timeout *= 4; | 539 timeout *= 4; |
| 540 } | 540 } |
| 541 break; | 541 break; |
| 542 } | 542 } |
| 543 configuration['timeout'] = timeout; | 543 configuration['timeout'] = timeout; |
| 544 } | 544 } |
| 545 | 545 |
| 546 return [configuration]; | 546 return [configuration]; |
| 547 } | 547 } |
| 548 | 548 |
| 549 /** | 549 /** |
| 550 * Helper for _expandConfigurations. Creates a new configuration and adds it | 550 * Helper for _expandConfigurations. Creates a new configuration and adds it |
| 551 * to a list, for use in a case when a particular configuration has multiple | 551 * to a list, for use in a case when a particular configuration has multiple |
| 552 * results (separated by a ','). | 552 * results (separated by a ','). |
| 553 * Arguments: | 553 * Arguments: |
| 554 * option: The particular test option we are expanding. | 554 * option: The particular test option we are expanding. |
| 555 * configuration: The map containing all test configuration information | 555 * configuration: The map containing all test configuration information |
| 556 * specified. | 556 * specified. |
| 557 */ | 557 */ |
| 558 List<Map> _expandHelper(String option, Map configuration) { | 558 List<Map> _expandHelper(String option, Map configuration) { |
| 559 var result = new List<Map>(); | 559 var result = new List<Map>(); |
| 560 var configs = configuration[option]; | 560 var configs = configuration[option]; |
| 561 for (var config in configs.split(',')) { | 561 for (var config in configs.split(',')) { |
| 562 var newConfiguration = new Map.from(configuration); | 562 var newConfiguration = new Map.from(configuration); |
| 563 newConfiguration[option] = config; | 563 newConfiguration[option] = config; |
| 564 result.addAll(_expandConfigurations(newConfiguration)); | 564 result.addAll(_expandConfigurations(newConfiguration)); |
| 565 } | 565 } |
| 566 return result; | 566 return result; |
| 567 } | 567 } |
| 568 | 568 |
| 569 | 569 |
| 570 /** | 570 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 return option; | 614 return option; |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 print('Unknown test option $name'); | 617 print('Unknown test option $name'); |
| 618 exit(1); | 618 exit(1); |
| 619 } | 619 } |
| 620 | 620 |
| 621 | 621 |
| 622 List<_TestOptionSpecification> _options; | 622 List<_TestOptionSpecification> _options; |
| 623 } | 623 } |
| OLD | NEW |