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 "drt_updater.dart"; | 8 import "drt_updater.dart"; |
9 import "test_suite.dart"; | 9 import "test_suite.dart"; |
10 import "path.dart"; | 10 import "path.dart"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class TestOptionsParser { | 43 class TestOptionsParser { |
44 /** | 44 /** |
45 * Creates a test options parser initialized with the known options. | 45 * Creates a test options parser initialized with the known options. |
46 */ | 46 */ |
47 TestOptionsParser() { | 47 TestOptionsParser() { |
48 _options = | 48 _options = |
49 [ new _TestOptionSpecification( | 49 [ new _TestOptionSpecification( |
50 'mode', | 50 'mode', |
51 'Mode in which to run the tests', | 51 'Mode in which to run the tests', |
52 ['-m', '--mode'], | 52 ['-m', '--mode'], |
53 ['all', 'debug', 'release'], | 53 ['all', 'debug', 'release', 'product'], |
54 'debug'), | 54 'debug'), |
55 new _TestOptionSpecification( | 55 new _TestOptionSpecification( |
56 'compiler', | 56 'compiler', |
57 '''Specify any compilation step (if needed). | 57 '''Specify any compilation step (if needed). |
58 | 58 |
59 none: Do not compile the Dart code (run native Dart code on the VM). | 59 none: Do not compile the Dart code (run native Dart code on the VM). |
60 (only valid with the following runtimes: vm, drt) | 60 (only valid with the following runtimes: vm, drt) |
61 | 61 |
62 dart2js: Compile dart code to JavaScript by running dart2js. | 62 dart2js: Compile dart code to JavaScript by running dart2js. |
63 (only valid with the following runtimes: d8, drt, chrome, | 63 (only valid with the following runtimes: d8, drt, chrome, |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 /** | 685 /** |
686 * Recursively expand a configuration with multiple values per key | 686 * Recursively expand a configuration with multiple values per key |
687 * into a list of configurations with exactly one value per key. | 687 * into a list of configurations with exactly one value per key. |
688 */ | 688 */ |
689 List<Map> _expandConfigurations(Map configuration) { | 689 List<Map> _expandConfigurations(Map configuration) { |
690 // Expand the pseudo-values such as 'all'. | 690 // Expand the pseudo-values such as 'all'. |
691 if (configuration['arch'] == 'all') { | 691 if (configuration['arch'] == 'all') { |
692 configuration['arch'] = 'ia32,x64,simarm,simarm64,simmips'; | 692 configuration['arch'] = 'ia32,x64,simarm,simarm64,simmips'; |
693 } | 693 } |
694 if (configuration['mode'] == 'all') { | 694 if (configuration['mode'] == 'all') { |
695 configuration['mode'] = 'debug,release'; | 695 configuration['mode'] = 'debug,release,product'; |
696 } | 696 } |
697 | 697 |
698 if (configuration['report_in_json']) { | 698 if (configuration['report_in_json']) { |
699 configuration['list'] = true; | 699 configuration['list'] = true; |
700 configuration['report'] = true; | 700 configuration['report'] = true; |
701 } | 701 } |
702 | 702 |
703 // Use verbose progress indication for verbose output unless buildbot | 703 // Use verbose progress indication for verbose output unless buildbot |
704 // progress indication is requested. | 704 // progress indication is requested. |
705 if (configuration['verbose'] && configuration['progress'] != 'buildbot') { | 705 if (configuration['verbose'] && configuration['progress'] != 'buildbot') { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 updater.update(); | 801 updater.update(); |
802 } | 802 } |
803 } | 803 } |
804 | 804 |
805 // Adjust default timeout based on mode, compiler, and sometimes runtime. | 805 // Adjust default timeout based on mode, compiler, and sometimes runtime. |
806 if (configuration['timeout'] == -1) { | 806 if (configuration['timeout'] == -1) { |
807 int compilerMulitiplier = | 807 int compilerMulitiplier = |
808 new CompilerConfiguration(configuration).computeTimeoutMultiplier(); | 808 new CompilerConfiguration(configuration).computeTimeoutMultiplier(); |
809 int runtimeMultiplier = | 809 int runtimeMultiplier = |
810 new RuntimeConfiguration(configuration).computeTimeoutMultiplier( | 810 new RuntimeConfiguration(configuration).computeTimeoutMultiplier( |
811 isDebug: configuration['mode'] == 'debug', | 811 mode: configuration['mode'], |
812 isChecked: configuration['checked'], | 812 isChecked: configuration['checked'], |
813 arch: configuration['arch']); | 813 arch: configuration['arch']); |
814 configuration['timeout'] = 60 * compilerMulitiplier * runtimeMultiplier; | 814 configuration['timeout'] = 60 * compilerMulitiplier * runtimeMultiplier; |
815 } | 815 } |
816 | 816 |
817 return [configuration]; | 817 return [configuration]; |
818 } | 818 } |
819 | 819 |
820 /** | 820 /** |
821 * Helper for _expandConfigurations. Creates a new configuration and adds it | 821 * Helper for _expandConfigurations. Creates a new configuration and adds it |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 return option; | 891 return option; |
892 } | 892 } |
893 } | 893 } |
894 print('Unknown test option $name'); | 894 print('Unknown test option $name'); |
895 exit(1); | 895 exit(1); |
896 } | 896 } |
897 | 897 |
898 | 898 |
899 List<_TestOptionSpecification> _options; | 899 List<_TestOptionSpecification> _options; |
900 } | 900 } |
OLD | NEW |