| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 runtime_configuration; | 5 library runtime_configuration; |
| 6 | 6 |
| 7 import 'compiler_configuration.dart' show | 7 import 'compiler_configuration.dart' show |
| 8 CommandArtifact; | 8 CommandArtifact; |
| 9 | 9 |
| 10 // TODO(ahe): Remove this import, we can precompute all the values required | 10 // TODO(ahe): Remove this import, we can precompute all the values required |
| 11 // from TestSuite once the refactoring is complete. | 11 // from TestSuite once the refactoring is complete. |
| 12 import 'test_suite.dart' show | 12 import 'test_suite.dart' show |
| 13 TestSuite; | 13 TestSuite; |
| 14 | 14 |
| 15 import 'test_runner.dart' show | 15 import 'test_runner.dart' show |
| 16 Command, | 16 Command, |
| 17 CommandBuilder; | 17 CommandBuilder; |
| 18 | 18 |
| 19 import 'utils.dart' show |
| 20 Path; |
| 21 |
| 19 // TODO(ahe): I expect this class will become abstract very soon. | 22 // TODO(ahe): I expect this class will become abstract very soon. |
| 20 class RuntimeConfiguration { | 23 class RuntimeConfiguration { |
| 21 // TODO(ahe): Remove this constructor and move the switch to | 24 // TODO(ahe): Remove this constructor and move the switch to |
| 22 // test_options.dart. We probably want to store an instance of | 25 // test_options.dart. We probably want to store an instance of |
| 23 // [RuntimeConfiguration] in [configuration] there. | 26 // [RuntimeConfiguration] in [configuration] there. |
| 24 factory RuntimeConfiguration(Map configuration) { | 27 factory RuntimeConfiguration(Map configuration) { |
| 25 String runtime = configuration['runtime']; | 28 String runtime = configuration['runtime']; |
| 26 switch (runtime) { | 29 switch (runtime) { |
| 27 case 'ContentShellOnAndroid': | 30 case 'ContentShellOnAndroid': |
| 28 case 'DartiumOnAndroid': | 31 case 'DartiumOnAndroid': |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 72 |
| 70 List<Command> computeRuntimeCommands( | 73 List<Command> computeRuntimeCommands( |
| 71 TestSuite suite, | 74 TestSuite suite, |
| 72 CommandBuilder commandBuilder, | 75 CommandBuilder commandBuilder, |
| 73 CommandArtifact artifact, | 76 CommandArtifact artifact, |
| 74 List<String> arguments, | 77 List<String> arguments, |
| 75 Map<String, String> environmentOverrides) { | 78 Map<String, String> environmentOverrides) { |
| 76 // TODO(ahe): Make this method abstract. | 79 // TODO(ahe): Make this method abstract. |
| 77 throw "Unimplemented runtime '$runtimeType'"; | 80 throw "Unimplemented runtime '$runtimeType'"; |
| 78 } | 81 } |
| 82 |
| 83 List<String> dart2jsPreambles(Path preambleDir) => []; |
| 79 } | 84 } |
| 80 | 85 |
| 81 /// The 'none' runtime configuration. | 86 /// The 'none' runtime configuration. |
| 82 class NoneRuntimeConfiguration extends RuntimeConfiguration { | 87 class NoneRuntimeConfiguration extends RuntimeConfiguration { |
| 83 NoneRuntimeConfiguration() | 88 NoneRuntimeConfiguration() |
| 84 : super._subclass(); | 89 : super._subclass(); |
| 85 | 90 |
| 86 List<Command> computeRuntimeCommands( | 91 List<Command> computeRuntimeCommands( |
| 87 TestSuite suite, | 92 TestSuite suite, |
| 88 CommandBuilder commandBuilder, | 93 CommandBuilder commandBuilder, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 117 CommandBuilder commandBuilder, | 122 CommandBuilder commandBuilder, |
| 118 CommandArtifact artifact, | 123 CommandArtifact artifact, |
| 119 List<String> arguments, | 124 List<String> arguments, |
| 120 Map<String, String> environmentOverrides) { | 125 Map<String, String> environmentOverrides) { |
| 121 // TODO(ahe): Avoid duplication of this method between d8 and jsshell. | 126 // TODO(ahe): Avoid duplication of this method between d8 and jsshell. |
| 122 checkArtifact(artifact); | 127 checkArtifact(artifact); |
| 123 return <Command>[ | 128 return <Command>[ |
| 124 commandBuilder.getJSCommandlineCommand( | 129 commandBuilder.getJSCommandlineCommand( |
| 125 moniker, suite.d8FileName, arguments, environmentOverrides)]; | 130 moniker, suite.d8FileName, arguments, environmentOverrides)]; |
| 126 } | 131 } |
| 132 |
| 133 List<String> dart2jsPreambles(Path preambleDir) { |
| 134 return [preambleDir.append('d8.js').toNativePath()]; |
| 135 } |
| 127 } | 136 } |
| 128 | 137 |
| 129 /// Firefox/SpiderMonkey-based development shell (jsshell). | 138 /// Firefox/SpiderMonkey-based development shell (jsshell). |
| 130 class JsshellRuntimeConfiguration extends CommandLineJavaScriptRuntime { | 139 class JsshellRuntimeConfiguration extends CommandLineJavaScriptRuntime { |
| 131 JsshellRuntimeConfiguration() | 140 JsshellRuntimeConfiguration() |
| 132 : super('jsshell'); | 141 : super('jsshell'); |
| 133 | 142 |
| 134 List<Command> computeRuntimeCommands( | 143 List<Command> computeRuntimeCommands( |
| 135 TestSuite suite, | 144 TestSuite suite, |
| 136 CommandBuilder commandBuilder, | 145 CommandBuilder commandBuilder, |
| 137 CommandArtifact artifact, | 146 CommandArtifact artifact, |
| 138 List<String> arguments, | 147 List<String> arguments, |
| 139 Map<String, String> environmentOverrides) { | 148 Map<String, String> environmentOverrides) { |
| 140 checkArtifact(artifact); | 149 checkArtifact(artifact); |
| 141 return <Command>[ | 150 return <Command>[ |
| 142 commandBuilder.getJSCommandlineCommand( | 151 commandBuilder.getJSCommandlineCommand( |
| 143 moniker, suite.jsShellFileName, arguments, environmentOverrides)]; | 152 moniker, suite.jsShellFileName, arguments, environmentOverrides)]; |
| 144 } | 153 } |
| 154 |
| 155 List<String> dart2jsPreambles(Path preambleDir) { |
| 156 return ['-f', preambleDir.append('jsshell.js').toNativePath(), '-f']; |
| 157 } |
| 145 } | 158 } |
| 146 | 159 |
| 147 /// Common runtime configuration for runtimes based on the Dart VM. | 160 /// Common runtime configuration for runtimes based on the Dart VM. |
| 148 class DartVmRuntimeConfiguration extends RuntimeConfiguration { | 161 class DartVmRuntimeConfiguration extends RuntimeConfiguration { |
| 149 DartVmRuntimeConfiguration() | 162 DartVmRuntimeConfiguration() |
| 150 : super._subclass(); | 163 : super._subclass(); |
| 151 | 164 |
| 152 int computeTimeoutMultiplier({ | 165 int computeTimeoutMultiplier({ |
| 153 bool isDebug: false, | 166 bool isDebug: false, |
| 154 bool isChecked: false, | 167 bool isChecked: false, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 222 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 210 List<Command> computeRuntimeCommands( | 223 List<Command> computeRuntimeCommands( |
| 211 TestSuite suite, | 224 TestSuite suite, |
| 212 CommandBuilder commandBuilder, | 225 CommandBuilder commandBuilder, |
| 213 CommandArtifact artifact, | 226 CommandArtifact artifact, |
| 214 List<String> arguments, | 227 List<String> arguments, |
| 215 Map<String, String> environmentOverrides) { | 228 Map<String, String> environmentOverrides) { |
| 216 throw "Unimplemented runtime '$runtimeType'"; | 229 throw "Unimplemented runtime '$runtimeType'"; |
| 217 } | 230 } |
| 218 } | 231 } |
| OLD | NEW |