| 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 && |
| 372 arguments == other.arguments && |
| 369 precompiledTestDirectory == other.precompiledTestDirectory; | 373 precompiledTestDirectory == other.precompiledTestDirectory; |
| 370 | 374 |
| 371 String toString() => 'Steps to push precompiled runner and precompiled code ' | 375 String toString() => 'Steps to push precompiled runner and precompiled code ' |
| 372 'to an attached device. Uses (and requires) adb.'; | 376 'to an attached device. Uses (and requires) adb.'; |
| 373 } | 377 } |
| 374 | 378 |
| 375 class JSCommandlineCommand extends ProcessCommand { | 379 class JSCommandlineCommand extends ProcessCommand { |
| 376 JSCommandlineCommand._( | 380 JSCommandlineCommand._( |
| 377 String displayName, String executable, List<String> arguments, | 381 String displayName, String executable, List<String> arguments, |
| 378 [Map<String, String> environmentOverrides = null]) | 382 [Map<String, String> environmentOverrides = null]) |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 637 } |
| 634 | 638 |
| 635 VmCommand getVmCommand(String executable, List<String> arguments, | 639 VmCommand getVmCommand(String executable, List<String> arguments, |
| 636 Map<String, String> environmentOverrides) { | 640 Map<String, String> environmentOverrides) { |
| 637 var command = new VmCommand._(executable, arguments, environmentOverrides); | 641 var command = new VmCommand._(executable, arguments, environmentOverrides); |
| 638 return _getUniqueCommand(command); | 642 return _getUniqueCommand(command); |
| 639 } | 643 } |
| 640 | 644 |
| 641 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, | 645 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, |
| 642 String testDirectory, | 646 String testDirectory, |
| 647 List<String> arguments, |
| 643 bool useBlobs) { | 648 bool useBlobs) { |
| 644 var command = new AdbPrecompilationCommand._( | 649 var command = new AdbPrecompilationCommand._( |
| 645 precompiledRunner, testDirectory, useBlobs); | 650 precompiledRunner, testDirectory, arguments, useBlobs); |
| 646 return _getUniqueCommand(command); | 651 return _getUniqueCommand(command); |
| 647 } | 652 } |
| 648 | 653 |
| 649 Command getJSCommandlineCommand(String displayName, executable, arguments, | 654 Command getJSCommandlineCommand(String displayName, executable, arguments, |
| 650 [environment = null]) { | 655 [environment = null]) { |
| 651 var command = new JSCommandlineCommand._( | 656 var command = new JSCommandlineCommand._( |
| 652 displayName, executable, arguments, environment); | 657 displayName, executable, arguments, environment); |
| 653 return _getUniqueCommand(command); | 658 return _getUniqueCommand(command); |
| 654 } | 659 } |
| 655 | 660 |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 }); | 2516 }); |
| 2512 } else { | 2517 } else { |
| 2513 return new RunningProcess(command, timeout).run(); | 2518 return new RunningProcess(command, timeout).run(); |
| 2514 } | 2519 } |
| 2515 } | 2520 } |
| 2516 | 2521 |
| 2517 Future<CommandOutput> _runAdbPrecompilationCommand( | 2522 Future<CommandOutput> _runAdbPrecompilationCommand( |
| 2518 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { | 2523 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { |
| 2519 var runner = command.precompiledRunnerFilename; | 2524 var runner = command.precompiledRunnerFilename; |
| 2520 var testdir = command.precompiledTestDirectory; | 2525 var testdir = command.precompiledTestDirectory; |
| 2526 var arguments = command.arguments; |
| 2521 var devicedir = '/data/local/tmp/precompilation-testing'; | 2527 var devicedir = '/data/local/tmp/precompilation-testing'; |
| 2522 var deviceTestDir = '/data/local/tmp/precompilation-testing/test'; | 2528 var deviceTestDir = '/data/local/tmp/precompilation-testing/test'; |
| 2523 | 2529 |
| 2524 // We copy all the files which the vm precompiler puts into the test | 2530 // We copy all the files which the vm precompiler puts into the test |
| 2525 // directory. | 2531 // directory. |
| 2526 List<String> files = new io.Directory(testdir) | 2532 List<String> files = new io.Directory(testdir) |
| 2527 .listSync() | 2533 .listSync() |
| 2528 .where((fse) => fse is io.File) | 2534 .where((fse) => fse is io.File) |
| 2529 .map((file) => file.path) | 2535 .map((file) => file.path) |
| 2530 .map((path) => path.substring(path.lastIndexOf('/') + 1)) | 2536 .map((path) => path.substring(path.lastIndexOf('/') + 1)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2549 | 2555 |
| 2550 for (var file in files) { | 2556 for (var file in files) { |
| 2551 steps.add(() => device.runAdbCommand( | 2557 steps.add(() => device.runAdbCommand( |
| 2552 ['push', '$testdir/$file', '$deviceTestDir/$file'])); | 2558 ['push', '$testdir/$file', '$deviceTestDir/$file'])); |
| 2553 } | 2559 } |
| 2554 | 2560 |
| 2555 if (command.useBlobs) { | 2561 if (command.useBlobs) { |
| 2556 steps.add(() => device.runAdbShellCommand( | 2562 steps.add(() => device.runAdbShellCommand( |
| 2557 ['$devicedir/dart_precompiled_runtime', | 2563 ['$devicedir/dart_precompiled_runtime', |
| 2558 '--run-app-snapshot=$deviceTestDir', | 2564 '--run-app-snapshot=$deviceTestDir', |
| 2559 '--use-blobs', 'ignored.dart'], | 2565 '--use-blobs']..addAll(arguments), |
| 2560 timeout: timeoutDuration)); | 2566 timeout: timeoutDuration)); |
| 2561 } else { | 2567 } else { |
| 2562 steps.add(() => device.runAdbShellCommand( | 2568 steps.add(() => device.runAdbShellCommand( |
| 2563 ['$devicedir/dart_precompiled_runtime', | 2569 ['$devicedir/dart_precompiled_runtime', |
| 2564 '--run-app-snapshot=$deviceTestDir', | 2570 '--run-app-snapshot=$deviceTestDir' |
| 2565 'ignored.dart'], | 2571 ]..addAll(arguments), |
| 2566 timeout: timeoutDuration)); | 2572 timeout: timeoutDuration)); |
| 2567 } | 2573 } |
| 2568 | 2574 |
| 2569 var stopwatch = new Stopwatch()..start(); | 2575 var stopwatch = new Stopwatch()..start(); |
| 2570 var writer = new StringBuffer(); | 2576 var writer = new StringBuffer(); |
| 2571 | 2577 |
| 2572 await device.waitForBootCompleted(); | 2578 await device.waitForBootCompleted(); |
| 2573 await device.waitForDevice(); | 2579 await device.waitForDevice(); |
| 2574 | 2580 |
| 2575 AdbCommandResult result; | 2581 AdbCommandResult result; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 } | 3027 } |
| 3022 } | 3028 } |
| 3023 | 3029 |
| 3024 void eventAllTestsDone() { | 3030 void eventAllTestsDone() { |
| 3025 for (var listener in _eventListener) { | 3031 for (var listener in _eventListener) { |
| 3026 listener.allDone(); | 3032 listener.allDone(); |
| 3027 } | 3033 } |
| 3028 _allDone(); | 3034 _allDone(); |
| 3029 } | 3035 } |
| 3030 } | 3036 } |
| OLD | NEW |