Chromium Code Reviews| 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 'dart:io' show Directory, File; | |
| 8 | |
| 7 import 'compiler_configuration.dart' show CommandArtifact; | 9 import 'compiler_configuration.dart' show CommandArtifact; |
| 8 | 10 |
| 9 // TODO(ahe): Remove this import, we can precompute all the values required | 11 // TODO(ahe): Remove this import, we can precompute all the values required |
| 10 // from TestSuite once the refactoring is complete. | 12 // from TestSuite once the refactoring is complete. |
| 11 import 'test_suite.dart' show TestSuite; | 13 import 'test_suite.dart' show TestSuite; |
| 12 | 14 |
| 13 import 'test_runner.dart' show Command, CommandBuilder; | 15 import 'test_runner.dart' show Command, CommandBuilder; |
| 14 | 16 |
| 15 // TODO(ahe): I expect this class will become abstract very soon. | 17 // TODO(ahe): I expect this class will become abstract very soon. |
| 16 class RuntimeConfiguration { | 18 class RuntimeConfiguration { |
| 17 // TODO(ahe): Remove this constructor and move the switch to | 19 // TODO(ahe): Remove this constructor and move the switch to |
| 18 // test_options.dart. We probably want to store an instance of | 20 // test_options.dart. We probably want to store an instance of |
|
Bill Hesse
2016/12/06 14:46:03
Notice here he points out that the instance can ev
asgerf
2016/12/06 15:41:49
Good point. Done.
| |
| 19 // [RuntimeConfiguration] in [configuration] there. | 21 // [RuntimeConfiguration] in [configuration] there. |
| 20 factory RuntimeConfiguration(Map configuration) { | 22 factory RuntimeConfiguration(Map configuration) { |
| 21 String runtime = configuration['runtime']; | 23 String runtime = configuration['runtime']; |
| 22 bool useBlobs = configuration['use_blobs']; | 24 bool useBlobs = configuration['use_blobs']; |
| 23 | 25 |
| 24 switch (runtime) { | 26 switch (runtime) { |
| 25 case 'ContentShellOnAndroid': | 27 case 'ContentShellOnAndroid': |
| 26 case 'DartiumOnAndroid': | 28 case 'DartiumOnAndroid': |
| 27 case 'chrome': | 29 case 'chrome': |
| 28 case 'chromeOnAndroid': | 30 case 'chromeOnAndroid': |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 52 | 54 |
| 53 case 'dart_precompiled': | 55 case 'dart_precompiled': |
| 54 if (configuration['system'] == 'android') { | 56 if (configuration['system'] == 'android') { |
| 55 return new DartPrecompiledAdbRuntimeConfiguration(useBlobs: useBlobs); | 57 return new DartPrecompiledAdbRuntimeConfiguration(useBlobs: useBlobs); |
| 56 } | 58 } |
| 57 return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); | 59 return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); |
| 58 | 60 |
| 59 case 'drt': | 61 case 'drt': |
| 60 return new DrtRuntimeConfiguration(); | 62 return new DrtRuntimeConfiguration(); |
| 61 | 63 |
| 64 case 'self_check': | |
| 65 return new SelfCheckRuntimeConfiguration(); | |
| 66 | |
| 62 default: | 67 default: |
| 63 throw "Unknown runtime '$runtime'"; | 68 throw "Unknown runtime '$runtime'"; |
| 64 } | 69 } |
| 65 } | 70 } |
| 66 | 71 |
| 67 RuntimeConfiguration._subclass(); | 72 RuntimeConfiguration._subclass(); |
| 68 | 73 |
| 69 int computeTimeoutMultiplier( | 74 int computeTimeoutMultiplier( |
| 70 {String mode, bool isChecked: false, bool isReload: false, String arch}) { | 75 {String mode, bool isChecked: false, bool isReload: false, String arch}) { |
| 71 return 1; | 76 return 1; |
| 72 } | 77 } |
| 73 | 78 |
| 74 List<Command> computeRuntimeCommands( | 79 List<Command> computeRuntimeCommands( |
| 75 TestSuite suite, | 80 TestSuite suite, |
| 76 CommandBuilder commandBuilder, | 81 CommandBuilder commandBuilder, |
| 77 CommandArtifact artifact, | 82 CommandArtifact artifact, |
| 78 List<String> arguments, | 83 List<String> arguments, |
| 79 Map<String, String> environmentOverrides) { | 84 Map<String, String> environmentOverrides) { |
| 80 // TODO(ahe): Make this method abstract. | 85 // TODO(ahe): Make this method abstract. |
| 81 throw "Unimplemented runtime '$runtimeType'"; | 86 throw "Unimplemented runtime '$runtimeType'"; |
| 82 } | 87 } |
| 83 | 88 |
| 84 List<String> dart2jsPreambles(Uri preambleDir) => []; | 89 List<String> dart2jsPreambles(Uri preambleDir) => []; |
| 90 | |
| 91 bool get shouldSkipNegativeTests => false; | |
| 85 } | 92 } |
| 86 | 93 |
| 87 /// The 'none' runtime configuration. | 94 /// The 'none' runtime configuration. |
| 88 class NoneRuntimeConfiguration extends RuntimeConfiguration { | 95 class NoneRuntimeConfiguration extends RuntimeConfiguration { |
| 89 NoneRuntimeConfiguration() : super._subclass(); | 96 NoneRuntimeConfiguration() : super._subclass(); |
| 90 | 97 |
| 91 List<Command> computeRuntimeCommands( | 98 List<Command> computeRuntimeCommands( |
| 92 TestSuite suite, | 99 TestSuite suite, |
| 93 CommandBuilder commandBuilder, | 100 CommandBuilder commandBuilder, |
| 94 CommandArtifact artifact, | 101 CommandArtifact artifact, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 return <Command>[ | 287 return <Command>[ |
| 281 commandBuilder.getAdbPrecompiledCommand(precompiledRunner, | 288 commandBuilder.getAdbPrecompiledCommand(precompiledRunner, |
| 282 processTest, | 289 processTest, |
| 283 script, | 290 script, |
| 284 arguments, | 291 arguments, |
| 285 useBlobs) | 292 useBlobs) |
| 286 ]; | 293 ]; |
| 287 } | 294 } |
| 288 } | 295 } |
| 289 | 296 |
| 297 class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration { | |
| 298 final List<String> selfCheckers = <String>[]; | |
| 299 | |
| 300 SelfCheckRuntimeConfiguration() { | |
| 301 searchForSelfCheckers(); | |
| 302 } | |
| 303 | |
| 304 void searchForSelfCheckers() { | |
| 305 for (var entry in new Directory('pkg').listSync(recursive: true)) { | |
|
Bill Hesse
2016/12/06 14:46:03
Please use the test utils to specify the full path
asgerf
2016/12/06 15:41:49
Done.
| |
| 306 if (entry is File && entry.path.endsWith('_self_check.dart')) { | |
| 307 selfCheckers.add(entry.path); | |
| 308 } | |
| 309 } | |
| 310 } | |
| 311 | |
| 312 List<Command> computeRuntimeCommands( | |
| 313 TestSuite suite, | |
| 314 CommandBuilder commandBuilder, | |
| 315 CommandArtifact artifact, | |
| 316 List<String> arguments, | |
| 317 Map<String, String> environmentOverrides) { | |
| 318 String executable = suite.dartVmBinaryFileName; | |
| 319 return selfCheckers | |
| 320 .map((String tester) => commandBuilder.getSelfCheckCommand( | |
| 321 executable, tester, arguments, environmentOverrides, | |
| 322 checked: suite.configuration['checked'])) | |
| 323 .toList(); | |
| 324 } | |
| 325 | |
| 326 @override | |
| 327 bool get shouldSkipNegativeTests => true; | |
| 328 } | |
| 329 | |
| 290 /// Temporary runtime configuration for browser runtimes that haven't been | 330 /// Temporary runtime configuration for browser runtimes that haven't been |
| 291 /// migrated yet. | 331 /// migrated yet. |
| 292 // TODO(ahe): Remove this class. | 332 // TODO(ahe): Remove this class. |
| 293 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 333 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 294 List<Command> computeRuntimeCommands( | 334 List<Command> computeRuntimeCommands( |
| 295 TestSuite suite, | 335 TestSuite suite, |
| 296 CommandBuilder commandBuilder, | 336 CommandBuilder commandBuilder, |
| 297 CommandArtifact artifact, | 337 CommandArtifact artifact, |
| 298 List<String> arguments, | 338 List<String> arguments, |
| 299 Map<String, String> environmentOverrides) { | 339 Map<String, String> environmentOverrides) { |
| 300 throw "Unimplemented runtime '$runtimeType'"; | 340 throw "Unimplemented runtime '$runtimeType'"; |
| 301 } | 341 } |
| 302 } | 342 } |
| OLD | NEW |