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; | 7 import 'dart:io' show Directory, File; |
8 | 8 |
9 import 'compiler_configuration.dart' show CommandArtifact; | 9 import 'compiler_configuration.dart' show CommandArtifact; |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 CommandArtifact artifact, | 274 CommandArtifact artifact, |
275 List<String> arguments, | 275 List<String> arguments, |
276 Map<String, String> environmentOverrides) { | 276 Map<String, String> environmentOverrides) { |
277 String script = artifact.filename; | 277 String script = artifact.filename; |
278 String type = artifact.mimeType; | 278 String type = artifact.mimeType; |
279 if (script != null && type != 'application/dart-precompiled') { | 279 if (script != null && type != 'application/dart-precompiled') { |
280 throw "dart_precompiled cannot run files of type '$type'."; | 280 throw "dart_precompiled cannot run files of type '$type'."; |
281 } | 281 } |
282 | 282 |
283 return <Command>[ | 283 return <Command>[ |
284 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 284 commandBuilder.getVmCommand( |
285 arguments, environmentOverrides) | 285 suite.dartPrecompiledBinaryFileName, arguments, environmentOverrides) |
286 ]; | 286 ]; |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 class DartPrecompiledAdbRuntimeConfiguration | 290 class DartPrecompiledAdbRuntimeConfiguration |
291 extends DartVmRuntimeConfiguration { | 291 extends DartVmRuntimeConfiguration { |
292 static const String DeviceDir = | 292 static const String DeviceDir = '/data/local/tmp/precompilation-testing'; |
293 '/data/local/tmp/precompilation-testing'; | |
294 static const String DeviceTestDir = | 293 static const String DeviceTestDir = |
295 '/data/local/tmp/precompilation-testing/test'; | 294 '/data/local/tmp/precompilation-testing/test'; |
296 | 295 |
297 final bool useBlobs; | 296 final bool useBlobs; |
298 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 297 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
299 | 298 |
300 List<Command> computeRuntimeCommands( | 299 List<Command> computeRuntimeCommands( |
301 TestSuite suite, | 300 TestSuite suite, |
302 CommandBuilder commandBuilder, | 301 CommandBuilder commandBuilder, |
303 CommandArtifact artifact, | 302 CommandArtifact artifact, |
304 List<String> arguments, | 303 List<String> arguments, |
305 Map<String, String> environmentOverrides) { | 304 Map<String, String> environmentOverrides) { |
306 String script = artifact.filename; | 305 String script = artifact.filename; |
307 String type = artifact.mimeType; | 306 String type = artifact.mimeType; |
308 if (script != null && type != 'application/dart-precompiled') { | 307 if (script != null && type != 'application/dart-precompiled') { |
309 throw "dart_precompiled cannot run files of type '$type'."; | 308 throw "dart_precompiled cannot run files of type '$type'."; |
310 } | 309 } |
311 | 310 |
312 String precompiledRunner = suite.dartPrecompiledBinaryFileName; | 311 String precompiledRunner = suite.dartPrecompiledBinaryFileName; |
313 String processTest = suite.processTestBinaryFileName; | 312 String processTest = suite.processTestBinaryFileName; |
314 return <Command>[ | 313 return <Command>[ |
315 commandBuilder.getAdbPrecompiledCommand(precompiledRunner, | 314 commandBuilder.getAdbPrecompiledCommand( |
316 processTest, | 315 precompiledRunner, processTest, script, arguments, useBlobs) |
317 script, | |
318 arguments, | |
319 useBlobs) | |
320 ]; | 316 ]; |
321 } | 317 } |
322 } | 318 } |
323 | 319 |
324 class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration { | 320 class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration { |
325 final List<String> selfCheckers = <String>[]; | 321 final List<String> selfCheckers = <String>[]; |
326 | 322 |
327 SelfCheckRuntimeConfiguration() { | 323 SelfCheckRuntimeConfiguration() { |
328 searchForSelfCheckers(); | 324 searchForSelfCheckers(); |
329 } | 325 } |
330 | 326 |
331 void searchForSelfCheckers() { | 327 void searchForSelfCheckers() { |
332 Uri pkg = TestUtils.dartDirUri.resolve('pkg'); | 328 Uri pkg = TestUtils.dartDirUri.resolve('pkg'); |
333 for (var entry in new Directory.fromUri(pkg).listSync(recursive: true)) { | 329 for (var entry in new Directory.fromUri(pkg).listSync(recursive: true)) { |
334 if (entry is File && entry.path.endsWith('_self_check.dart')) { | 330 if (entry is File && entry.path.endsWith('_self_check.dart')) { |
335 selfCheckers.add(entry.path); | 331 selfCheckers.add(entry.path); |
336 } | 332 } |
337 } | 333 } |
338 } | 334 } |
339 | 335 |
340 List<Command> computeRuntimeCommands( | 336 List<Command> computeRuntimeCommands( |
341 TestSuite suite, | 337 TestSuite suite, |
342 CommandBuilder commandBuilder, | 338 CommandBuilder commandBuilder, |
343 CommandArtifact artifact, | 339 CommandArtifact artifact, |
(...skipping 17 matching lines...) Expand all Loading... |
361 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 357 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
362 List<Command> computeRuntimeCommands( | 358 List<Command> computeRuntimeCommands( |
363 TestSuite suite, | 359 TestSuite suite, |
364 CommandBuilder commandBuilder, | 360 CommandBuilder commandBuilder, |
365 CommandArtifact artifact, | 361 CommandArtifact artifact, |
366 List<String> arguments, | 362 List<String> arguments, |
367 Map<String, String> environmentOverrides) { | 363 Map<String, String> environmentOverrides) { |
368 throw "Unimplemented runtime '$runtimeType'"; | 364 throw "Unimplemented runtime '$runtimeType'"; |
369 } | 365 } |
370 } | 366 } |
OLD | NEW |