OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 | 341 |
342 class VmCommand extends ProcessCommand { | 342 class VmCommand extends ProcessCommand { |
343 VmCommand._(String executable, List<String> arguments, | 343 VmCommand._(String executable, List<String> arguments, |
344 Map<String, String> environmentOverrides) | 344 Map<String, String> environmentOverrides) |
345 : super._("vm", executable, arguments, environmentOverrides); | 345 : super._("vm", executable, arguments, environmentOverrides); |
346 } | 346 } |
347 | 347 |
348 class AdbPrecompilationCommand extends Command { | 348 class AdbPrecompilationCommand extends Command { |
349 final String precompiledRunnerFilename; | 349 final String precompiledRunnerFilename; |
350 final String precompiledTestDirectory; | 350 final String precompiledTestDirectory; |
351 final List<String> arguments; | |
351 final bool useBlobs; | 352 final bool useBlobs; |
352 | 353 |
353 AdbPrecompilationCommand._(this.precompiledRunnerFilename, | 354 AdbPrecompilationCommand._(this.precompiledRunnerFilename, |
354 this.precompiledTestDirectory, | 355 this.precompiledTestDirectory, |
356 this.arguments, | |
355 this.useBlobs) | 357 this.useBlobs) |
356 : super._("adb_precompilation"); | 358 : super._("adb_precompilation"); |
357 | 359 |
358 void _buildHashCode(HashCodeBuilder builder) { | 360 void _buildHashCode(HashCodeBuilder builder) { |
359 super._buildHashCode(builder); | 361 super._buildHashCode(builder); |
360 builder.add(precompiledRunnerFilename); | 362 builder.add(precompiledRunnerFilename); |
361 builder.add(precompiledTestDirectory); | 363 builder.add(precompiledTestDirectory); |
364 builder.add(arguments); | |
362 builder.add(useBlobs); | 365 builder.add(useBlobs); |
363 } | 366 } |
364 | 367 |
365 bool _equal(AdbPrecompilationCommand other) => | 368 bool _equal(AdbPrecompilationCommand other) => |
366 super._equal(other) && | 369 super._equal(other) && |
367 precompiledRunnerFilename == other.precompiledRunnerFilename && | 370 precompiledRunnerFilename == other.precompiledRunnerFilename && |
368 useBlobs == other.useBlobs && | 371 useBlobs == other.useBlobs && |
369 precompiledTestDirectory == other.precompiledTestDirectory; | 372 precompiledTestDirectory == other.precompiledTestDirectory; |
kustermann
2016/05/18 18:41:15
You should probably also add "arguments" here (dee
Florian Schneider
2016/05/18 18:55:31
Done.
| |
370 | 373 |
371 String toString() => 'Steps to push precompiled runner and precompiled code ' | 374 String toString() => 'Steps to push precompiled runner and precompiled code ' |
372 'to an attached device. Uses (and requires) adb.'; | 375 'to an attached device. Uses (and requires) adb.'; |
373 } | 376 } |
374 | 377 |
375 class JSCommandlineCommand extends ProcessCommand { | 378 class JSCommandlineCommand extends ProcessCommand { |
376 JSCommandlineCommand._( | 379 JSCommandlineCommand._( |
377 String displayName, String executable, List<String> arguments, | 380 String displayName, String executable, List<String> arguments, |
378 [Map<String, String> environmentOverrides = null]) | 381 [Map<String, String> environmentOverrides = null]) |
379 : super._(displayName, executable, arguments, environmentOverrides); | 382 : super._(displayName, executable, arguments, environmentOverrides); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 } | 636 } |
634 | 637 |
635 VmCommand getVmCommand(String executable, List<String> arguments, | 638 VmCommand getVmCommand(String executable, List<String> arguments, |
636 Map<String, String> environmentOverrides) { | 639 Map<String, String> environmentOverrides) { |
637 var command = new VmCommand._(executable, arguments, environmentOverrides); | 640 var command = new VmCommand._(executable, arguments, environmentOverrides); |
638 return _getUniqueCommand(command); | 641 return _getUniqueCommand(command); |
639 } | 642 } |
640 | 643 |
641 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, | 644 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, |
642 String testDirectory, | 645 String testDirectory, |
646 List<String> arguments, | |
643 bool useBlobs) { | 647 bool useBlobs) { |
644 var command = new AdbPrecompilationCommand._( | 648 var command = new AdbPrecompilationCommand._( |
645 precompiledRunner, testDirectory, useBlobs); | 649 precompiledRunner, testDirectory, arguments, useBlobs); |
646 return _getUniqueCommand(command); | 650 return _getUniqueCommand(command); |
647 } | 651 } |
648 | 652 |
649 Command getJSCommandlineCommand(String displayName, executable, arguments, | 653 Command getJSCommandlineCommand(String displayName, executable, arguments, |
650 [environment = null]) { | 654 [environment = null]) { |
651 var command = new JSCommandlineCommand._( | 655 var command = new JSCommandlineCommand._( |
652 displayName, executable, arguments, environment); | 656 displayName, executable, arguments, environment); |
653 return _getUniqueCommand(command); | 657 return _getUniqueCommand(command); |
654 } | 658 } |
655 | 659 |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2511 }); | 2515 }); |
2512 } else { | 2516 } else { |
2513 return new RunningProcess(command, timeout).run(); | 2517 return new RunningProcess(command, timeout).run(); |
2514 } | 2518 } |
2515 } | 2519 } |
2516 | 2520 |
2517 Future<CommandOutput> _runAdbPrecompilationCommand( | 2521 Future<CommandOutput> _runAdbPrecompilationCommand( |
2518 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { | 2522 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { |
2519 var runner = command.precompiledRunnerFilename; | 2523 var runner = command.precompiledRunnerFilename; |
2520 var testdir = command.precompiledTestDirectory; | 2524 var testdir = command.precompiledTestDirectory; |
2525 var arguments = command.arguments; | |
2521 var devicedir = '/data/local/tmp/precompilation-testing'; | 2526 var devicedir = '/data/local/tmp/precompilation-testing'; |
2522 var deviceTestDir = '/data/local/tmp/precompilation-testing/test'; | 2527 var deviceTestDir = '/data/local/tmp/precompilation-testing/test'; |
2523 | 2528 |
2524 // We copy all the files which the vm precompiler puts into the test | 2529 // We copy all the files which the vm precompiler puts into the test |
2525 // directory. | 2530 // directory. |
2526 List<String> files = new io.Directory(testdir) | 2531 List<String> files = new io.Directory(testdir) |
2527 .listSync() | 2532 .listSync() |
2528 .where((fse) => fse is io.File) | 2533 .where((fse) => fse is io.File) |
2529 .map((file) => file.path) | 2534 .map((file) => file.path) |
2530 .map((path) => path.substring(path.lastIndexOf('/') + 1)) | 2535 .map((path) => path.substring(path.lastIndexOf('/') + 1)) |
(...skipping 18 matching lines...) Expand all Loading... | |
2549 | 2554 |
2550 for (var file in files) { | 2555 for (var file in files) { |
2551 steps.add(() => device.runAdbCommand( | 2556 steps.add(() => device.runAdbCommand( |
2552 ['push', '$testdir/$file', '$deviceTestDir/$file'])); | 2557 ['push', '$testdir/$file', '$deviceTestDir/$file'])); |
2553 } | 2558 } |
2554 | 2559 |
2555 if (command.useBlobs) { | 2560 if (command.useBlobs) { |
2556 steps.add(() => device.runAdbShellCommand( | 2561 steps.add(() => device.runAdbShellCommand( |
2557 ['$devicedir/dart_precompiled_runtime', | 2562 ['$devicedir/dart_precompiled_runtime', |
2558 '--run-app-snapshot=$deviceTestDir', | 2563 '--run-app-snapshot=$deviceTestDir', |
2559 '--use-blobs', 'ignored.dart'], | 2564 '--use-blobs']..addAll(arguments), |
2560 timeout: timeoutDuration)); | 2565 timeout: timeoutDuration)); |
2561 } else { | 2566 } else { |
2562 steps.add(() => device.runAdbShellCommand( | 2567 steps.add(() => device.runAdbShellCommand( |
2563 ['$devicedir/dart_precompiled_runtime', | 2568 ['$devicedir/dart_precompiled_runtime', |
2564 '--run-app-snapshot=$deviceTestDir', | 2569 '--run-app-snapshot=$deviceTestDir' |
2565 'ignored.dart'], | 2570 ]..addAll(arguments), |
2566 timeout: timeoutDuration)); | 2571 timeout: timeoutDuration)); |
2567 } | 2572 } |
2568 | 2573 |
2569 var stopwatch = new Stopwatch()..start(); | 2574 var stopwatch = new Stopwatch()..start(); |
2570 var writer = new StringBuffer(); | 2575 var writer = new StringBuffer(); |
2571 | 2576 |
2572 await device.waitForBootCompleted(); | 2577 await device.waitForBootCompleted(); |
2573 await device.waitForDevice(); | 2578 await device.waitForDevice(); |
2574 | 2579 |
2575 AdbCommandResult result; | 2580 AdbCommandResult result; |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3021 } | 3026 } |
3022 } | 3027 } |
3023 | 3028 |
3024 void eventAllTestsDone() { | 3029 void eventAllTestsDone() { |
3025 for (var listener in _eventListener) { | 3030 for (var listener in _eventListener) { |
3026 listener.allDone(); | 3031 listener.allDone(); |
3027 } | 3032 } |
3028 _allDone(); | 3033 _allDone(); |
3029 } | 3034 } |
3030 } | 3035 } |
OLD | NEW |