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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 : super._("vm", executable, arguments, environmentOverrides); | 348 : super._("vm", executable, arguments, environmentOverrides); |
349 } | 349 } |
350 | 350 |
351 class AdbPrecompilationCommand extends Command { | 351 class AdbPrecompilationCommand extends Command { |
352 final String precompiledRunnerFilename; | 352 final String precompiledRunnerFilename; |
353 final String precompiledTestDirectory; | 353 final String precompiledTestDirectory; |
354 final List<String> arguments; | 354 final List<String> arguments; |
355 final bool useBlobs; | 355 final bool useBlobs; |
356 | 356 |
357 AdbPrecompilationCommand._(this.precompiledRunnerFilename, | 357 AdbPrecompilationCommand._(this.precompiledRunnerFilename, |
358 this.precompiledTestDirectory, | 358 this.precompiledTestDirectory, this.arguments, this.useBlobs) |
359 this.arguments, | |
360 this.useBlobs) | |
361 : super._("adb_precompilation"); | 359 : super._("adb_precompilation"); |
362 | 360 |
363 void _buildHashCode(HashCodeBuilder builder) { | 361 void _buildHashCode(HashCodeBuilder builder) { |
364 super._buildHashCode(builder); | 362 super._buildHashCode(builder); |
365 builder.add(precompiledRunnerFilename); | 363 builder.add(precompiledRunnerFilename); |
366 builder.add(precompiledTestDirectory); | 364 builder.add(precompiledTestDirectory); |
367 builder.add(arguments); | 365 builder.add(arguments); |
368 builder.add(useBlobs); | 366 builder.add(useBlobs); |
369 } | 367 } |
370 | 368 |
371 bool _equal(AdbPrecompilationCommand other) => | 369 bool _equal(AdbPrecompilationCommand other) => |
372 super._equal(other) && | 370 super._equal(other) && |
373 precompiledRunnerFilename == other.precompiledRunnerFilename && | 371 precompiledRunnerFilename == other.precompiledRunnerFilename && |
374 useBlobs == other.useBlobs && | 372 useBlobs == other.useBlobs && |
375 arguments == other.arguments && | 373 arguments == other.arguments && |
376 precompiledTestDirectory == other.precompiledTestDirectory; | 374 precompiledTestDirectory == other.precompiledTestDirectory; |
377 | 375 |
378 String toString() => 'Steps to push precompiled runner and precompiled code ' | 376 String toString() => 'Steps to push precompiled runner and precompiled code ' |
379 'to an attached device. Uses (and requires) adb.'; | 377 'to an attached device. Uses (and requires) adb.'; |
380 } | 378 } |
381 | 379 |
382 class JSCommandlineCommand extends ProcessCommand { | 380 class JSCommandlineCommand extends ProcessCommand { |
383 JSCommandlineCommand._( | 381 JSCommandlineCommand._( |
384 String displayName, String executable, List<String> arguments, | 382 String displayName, String executable, List<String> arguments, |
385 [Map<String, String> environmentOverrides = null]) | 383 [Map<String, String> environmentOverrides = null]) |
386 : super._(displayName, executable, arguments, environmentOverrides); | 384 : super._(displayName, executable, arguments, environmentOverrides); |
387 } | 385 } |
388 | 386 |
389 class PubCommand extends ProcessCommand { | 387 class PubCommand extends ProcessCommand { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 super._equal(other) && | 457 super._equal(other) && |
460 _sourceDirectory == other._sourceDirectory && | 458 _sourceDirectory == other._sourceDirectory && |
461 _destinationDirectory == other._destinationDirectory; | 459 _destinationDirectory == other._destinationDirectory; |
462 } | 460 } |
463 | 461 |
464 class ModifyPubspecYamlCommand extends ScriptCommand { | 462 class ModifyPubspecYamlCommand extends ScriptCommand { |
465 String _pubspecYamlFile; | 463 String _pubspecYamlFile; |
466 String _destinationFile; | 464 String _destinationFile; |
467 Map<String, Map> _dependencyOverrides; | 465 Map<String, Map> _dependencyOverrides; |
468 | 466 |
469 ModifyPubspecYamlCommand._(this._pubspecYamlFile, | 467 ModifyPubspecYamlCommand._( |
470 this._destinationFile, this._dependencyOverrides) | 468 this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides) |
471 : super._("modify_pubspec") { | 469 : super._("modify_pubspec") { |
472 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); | 470 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); |
473 assert(_destinationFile.endsWith("pubspec.yaml")); | 471 assert(_destinationFile.endsWith("pubspec.yaml")); |
474 } | 472 } |
475 | 473 |
476 static Map<String, Map> _filterOverrides( | 474 static Map<String, Map> _filterOverrides( |
477 String pubspec, Map<String, Map> overrides) { | 475 String pubspec, Map<String, Map> overrides) { |
478 if (overrides.isEmpty) return overrides; | 476 if (overrides.isEmpty) return overrides; |
479 var yaml = loadYaml(pubspec); | 477 var yaml = loadYaml(pubspec); |
480 var deps = yaml['dependencies']; | 478 var deps = yaml['dependencies']; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 return _getUniqueCommand(command); | 658 return _getUniqueCommand(command); |
661 } | 659 } |
662 | 660 |
663 VmCommand getVmCommand(String executable, List<String> arguments, | 661 VmCommand getVmCommand(String executable, List<String> arguments, |
664 Map<String, String> environmentOverrides) { | 662 Map<String, String> environmentOverrides) { |
665 var command = new VmCommand._(executable, arguments, environmentOverrides); | 663 var command = new VmCommand._(executable, arguments, environmentOverrides); |
666 return _getUniqueCommand(command); | 664 return _getUniqueCommand(command); |
667 } | 665 } |
668 | 666 |
669 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, | 667 AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, |
670 String testDirectory, | 668 String testDirectory, List<String> arguments, bool useBlobs) { |
671 List<String> arguments, | |
672 bool useBlobs) { | |
673 var command = new AdbPrecompilationCommand._( | 669 var command = new AdbPrecompilationCommand._( |
674 precompiledRunner, testDirectory, arguments, useBlobs); | 670 precompiledRunner, testDirectory, arguments, useBlobs); |
675 return _getUniqueCommand(command); | 671 return _getUniqueCommand(command); |
676 } | 672 } |
677 | 673 |
678 Command getJSCommandlineCommand(String displayName, executable, arguments, | 674 Command getJSCommandlineCommand(String displayName, executable, arguments, |
679 [environment = null]) { | 675 [environment = null]) { |
680 var command = new JSCommandlineCommand._( | 676 var command = new JSCommandlineCommand._( |
681 displayName, executable, arguments, environment); | 677 displayName, executable, arguments, environment); |
682 return _getUniqueCommand(command); | 678 return _getUniqueCommand(command); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 } | 1029 } |
1034 | 1030 |
1035 // Reverse result of a negative test. | 1031 // Reverse result of a negative test. |
1036 bool hasFailed(TestCase testCase) { | 1032 bool hasFailed(TestCase testCase) { |
1037 return testCase.isNegative ? !didFail(testCase) : didFail(testCase); | 1033 return testCase.isNegative ? !didFail(testCase) : didFail(testCase); |
1038 } | 1034 } |
1039 | 1035 |
1040 Expectation _negateOutcomeIfNegativeTest( | 1036 Expectation _negateOutcomeIfNegativeTest( |
1041 Expectation outcome, bool isNegative) { | 1037 Expectation outcome, bool isNegative) { |
1042 if (!isNegative) return outcome; | 1038 if (!isNegative) return outcome; |
1043 | 1039 if (outcome == Expectation.IGNORE) return outcome; |
1044 if (outcome.canBeOutcomeOf(Expectation.FAIL)) { | 1040 if (outcome.canBeOutcomeOf(Expectation.FAIL)) { |
1045 return Expectation.PASS; | 1041 return Expectation.PASS; |
1046 } | 1042 } |
1047 return Expectation.FAIL; | 1043 return Expectation.FAIL; |
1048 } | 1044 } |
1049 } | 1045 } |
1050 | 1046 |
1051 class BrowserCommandOutputImpl extends CommandOutputImpl { | 1047 class BrowserCommandOutputImpl extends CommandOutputImpl { |
1052 // Although tests are reported as passing, content shell sometimes exits with | 1048 // Although tests are reported as passing, content shell sometimes exits with |
1053 // a nonzero exitcode which makes our dartium builders extremely falky. | 1049 // a nonzero exitcode which makes our dartium builders extremely falky. |
1054 // See: http://dartbug.com/15139. | 1050 // See: http://dartbug.com/15139. |
1055 static int WHITELISTED_CONTENTSHELL_EXITCODE = -1073740022; | 1051 static int WHITELISTED_CONTENTSHELL_EXITCODE = -1073740022; |
1056 static bool isWindows = io.Platform.operatingSystem == 'windows'; | 1052 static bool isWindows = io.Platform.operatingSystem == 'windows'; |
1057 static bool _failedBecauseOfFlakyInfrastructure(List<int> stderrBytes) { | 1053 static bool _failedBecauseOfFlakyInfrastructure(List<int> stderrBytes) { |
1058 // If the browser test failed, it may have been because content shell | 1054 // If the browser test failed, it may have been because content shell |
1059 // and the virtual framebuffer X server didn't hook up, or it crashed with | 1055 // and the virtual framebuffer X server didn't hook up, or it crashed with |
1060 // a core dump. Sometimes content shell crashes after it has set the stdout | 1056 // a core dump. Sometimes content shell crashes after it has set the stdout |
1061 // to PASS, so we have to do this check first. | 1057 // to PASS, so we have to do this check first. |
1062 // Content shell also fails with a broken pipe message: Issue 26739 | 1058 // Content shell also fails with a broken pipe message: Issue 26739 |
1063 var zygoteCrash = new RegExp( | 1059 var zygoteCrash = |
1064 r"ERROR:zygote_linux\.cc\(\d+\)] write: Broken pipe"); | 1060 new RegExp(r"ERROR:zygote_linux\.cc\(\d+\)] write: Broken pipe"); |
1065 var stderr = decodeUtf8(stderrBytes); | 1061 var stderr = decodeUtf8(stderrBytes); |
1066 // TODO(whesse): Issue: 7564 | 1062 // TODO(whesse): Issue: 7564 |
1067 // This may not be happening anymore. Test by removing this suppression. | 1063 // This may not be happening anymore. Test by removing this suppression. |
1068 if (stderr.contains(MESSAGE_CANNOT_OPEN_DISPLAY) || | 1064 if (stderr.contains(MESSAGE_CANNOT_OPEN_DISPLAY) || |
1069 stderr.contains(MESSAGE_FAILED_TO_RUN_COMMAND)) { | 1065 stderr.contains(MESSAGE_FAILED_TO_RUN_COMMAND)) { |
1070 DebugLogger.warning( | 1066 DebugLogger.warning( |
1071 "Warning: Failure because of missing XDisplay. Test ignored"); | 1067 "Warning: Failure because of missing XDisplay. Test ignored"); |
1072 return true; | 1068 return true; |
1073 } | 1069 } |
1074 // Issue 26739 | 1070 // Issue 26739 |
1075 if (zygoteCrash.hasMatch(stderr)) { | 1071 if (zygoteCrash.hasMatch(stderr)) { |
1076 DebugLogger.warning("Warning: Failure because of content_shell " | 1072 DebugLogger.warning("Warning: Failure because of content_shell " |
1077 "zygote crash. Test ignored"); | 1073 "zygote crash. Test ignored"); |
1078 return true; | 1074 return true; |
1079 } | 1075 } |
1080 return false; | 1076 return false; |
1081 } | 1077 } |
1082 | 1078 |
1083 bool _infraFailure; | 1079 bool _infraFailure; |
1084 | 1080 |
1085 BrowserCommandOutputImpl( | 1081 BrowserCommandOutputImpl( |
1086 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped) | 1082 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped) |
1087 : super(command, exitCode, timedOut, stdout, stderr, time, | 1083 : super(command, exitCode, timedOut, stdout, stderr, time, |
1088 compilationSkipped, 0), | 1084 compilationSkipped, 0), |
1089 _infraFailure = _failedBecauseOfFlakyInfrastructure(stderr); | 1085 _infraFailure = _failedBecauseOfFlakyInfrastructure(stderr); |
1090 | 1086 |
1091 Expectation result(TestCase testCase) { | 1087 Expectation result(TestCase testCase) { |
1092 // Handle crashes and timeouts first | 1088 // Handle crashes and timeouts first |
1093 if (hasCrashed) return Expectation.CRASH; | 1089 if (hasCrashed) return Expectation.CRASH; |
1094 if (hasTimedOut) return Expectation.TIMEOUT; | 1090 if (hasTimedOut) return Expectation.TIMEOUT; |
1095 | 1091 |
1096 if (_infraFailure) { | 1092 if (_infraFailure) { |
1097 return Expectation.IGNORE; | 1093 return Expectation.IGNORE; |
1098 } | 1094 } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1565 List<int> stdout, | 1561 List<int> stdout, |
1566 List<int> stderr, | 1562 List<int> stderr, |
1567 Duration time, | 1563 Duration time, |
1568 bool compilationSkipped) | 1564 bool compilationSkipped) |
1569 : super(command, exitCode, timedOut, stdout, stderr, time, | 1565 : super(command, exitCode, timedOut, stdout, stderr, time, |
1570 compilationSkipped, 0); | 1566 compilationSkipped, 0); |
1571 | 1567 |
1572 Expectation result(TestCase testCase) { | 1568 Expectation result(TestCase testCase) { |
1573 // Handle general crash/timeout detection. | 1569 // Handle general crash/timeout detection. |
1574 if (hasCrashed) return Expectation.CRASH; | 1570 if (hasCrashed) return Expectation.CRASH; |
1575 if (hasTimedOut) return Expectation.TIMEOUT; | 1571 if (hasTimedOut) { |
1572 bool isWindows = io.Platform.operatingSystem == 'windows'; | |
1573 bool isBrowserTestCase = | |
1574 testCase.commands.any((command) => command is BrowserTestCommand); | |
1575 // TODO(26060) Dart2js batch mode hangs on Windows under heavy load. | |
1576 return (isWindows && isBrowserTestCase) | |
Søren Gjesse
2016/06/28 14:40:08
Don't you want to count the number of ignores, so
Bill Hesse
2016/06/28 14:45:59
The number of ignores is counted at a higher level
Søren Gjesse
2016/06/28 15:12:19
Thanks for the clarification.
| |
1577 ? Expectation.IGNORE | |
1578 : Expectation.TIMEOUT; | |
1579 } | |
1576 | 1580 |
1577 // Handle dart2js specific crash detection | 1581 // Handle dart2js specific crash detection |
1578 if (exitCode == DART2JS_EXITCODE_CRASH || | 1582 if (exitCode == DART2JS_EXITCODE_CRASH || |
1579 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || | 1583 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || |
1580 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { | 1584 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { |
1581 return Expectation.CRASH; | 1585 return Expectation.CRASH; |
1582 } | 1586 } |
1583 | 1587 |
1584 // Multitests are handled specially | 1588 // Multitests are handled specially |
1585 if (testCase.expectCompileError) { | 1589 if (testCase.expectCompileError) { |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2515 return _getBatchRunner("dart2js") | 2519 return _getBatchRunner("dart2js") |
2516 .runCommand("dart2js", command, timeout, command.arguments); | 2520 .runCommand("dart2js", command, timeout, command.arguments); |
2517 } else if (command is AnalysisCommand && batchMode) { | 2521 } else if (command is AnalysisCommand && batchMode) { |
2518 return _getBatchRunner(command.flavor) | 2522 return _getBatchRunner(command.flavor) |
2519 .runCommand(command.flavor, command, timeout, command.arguments); | 2523 .runCommand(command.flavor, command, timeout, command.arguments); |
2520 } else if (command is ScriptCommand) { | 2524 } else if (command is ScriptCommand) { |
2521 return command.run(); | 2525 return command.run(); |
2522 } else if (command is AdbPrecompilationCommand) { | 2526 } else if (command is AdbPrecompilationCommand) { |
2523 assert(adbDevicePool != null); | 2527 assert(adbDevicePool != null); |
2524 return adbDevicePool.acquireDevice().then((AdbDevice device) { | 2528 return adbDevicePool.acquireDevice().then((AdbDevice device) { |
2525 return _runAdbPrecompilationCommand( | 2529 return _runAdbPrecompilationCommand(device, command, timeout) |
2526 device, command, timeout).whenComplete(() { | 2530 .whenComplete(() { |
2527 adbDevicePool.releaseDevice(device); | 2531 adbDevicePool.releaseDevice(device); |
2528 }); | 2532 }); |
2529 }); | 2533 }); |
2530 } else { | 2534 } else { |
2531 return new RunningProcess(command, timeout).run(); | 2535 return new RunningProcess(command, timeout).run(); |
2532 } | 2536 } |
2533 } | 2537 } |
2534 | 2538 |
2535 Future<CommandOutput> _runAdbPrecompilationCommand( | 2539 Future<CommandOutput> _runAdbPrecompilationCommand( |
2536 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { | 2540 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { |
(...skipping 10 matching lines...) Expand all Loading... | |
2547 .where((fse) => fse is io.File) | 2551 .where((fse) => fse is io.File) |
2548 .map((file) => file.path) | 2552 .map((file) => file.path) |
2549 .map((path) => path.substring(path.lastIndexOf('/') + 1)) | 2553 .map((path) => path.substring(path.lastIndexOf('/') + 1)) |
2550 .toList(); | 2554 .toList(); |
2551 | 2555 |
2552 var timeoutDuration = new Duration(seconds: timeout); | 2556 var timeoutDuration = new Duration(seconds: timeout); |
2553 | 2557 |
2554 // All closures are of type "Future<AdbCommandResult> run()" | 2558 // All closures are of type "Future<AdbCommandResult> run()" |
2555 List<Function> steps = []; | 2559 List<Function> steps = []; |
2556 | 2560 |
2557 steps.add(() => device.runAdbShellCommand( | 2561 steps.add(() => device.runAdbShellCommand(['rm', '-Rf', deviceTestDir])); |
2558 ['rm', '-Rf', deviceTestDir])); | 2562 steps.add(() => device.runAdbShellCommand(['mkdir', '-p', deviceTestDir])); |
2559 steps.add(() => device.runAdbShellCommand( | |
2560 ['mkdir', '-p', deviceTestDir])); | |
2561 // TODO: We should find a way for us to cache the runner binary and avoid | 2563 // TODO: We should find a way for us to cache the runner binary and avoid |
2562 // pushhing it for every single test (this is bad for SSD cycle time, test | 2564 // pushhing it for every single test (this is bad for SSD cycle time, test |
2563 // timing). | 2565 // timing). |
2564 steps.add(() => device.runAdbCommand( | 2566 steps.add(() => device.runAdbCommand( |
2565 ['push', runner, '$devicedir/dart_precompiled_runtime'])); | 2567 ['push', runner, '$devicedir/dart_precompiled_runtime'])); |
2566 steps.add(() => device.runAdbShellCommand( | 2568 steps.add(() => device.runAdbShellCommand( |
2567 ['chmod', '777', '$devicedir/dart_precompiled_runtime'])); | 2569 ['chmod', '777', '$devicedir/dart_precompiled_runtime'])); |
2568 | 2570 |
2569 for (var file in files) { | 2571 for (var file in files) { |
2570 steps.add(() => device.runAdbCommand( | 2572 steps.add(() => device |
2571 ['push', '$testdir/$file', '$deviceTestDir/$file'])); | 2573 .runAdbCommand(['push', '$testdir/$file', '$deviceTestDir/$file'])); |
2572 } | 2574 } |
2573 | 2575 |
2574 if (command.useBlobs) { | 2576 if (command.useBlobs) { |
2575 steps.add(() => device.runAdbShellCommand( | 2577 steps.add(() => device.runAdbShellCommand( |
2576 ['$devicedir/dart_precompiled_runtime', | 2578 [ |
2577 '--run-app-snapshot=$deviceTestDir', | 2579 '$devicedir/dart_precompiled_runtime', |
2578 '--use-blobs']..addAll(arguments), | 2580 '--run-app-snapshot=$deviceTestDir', |
2579 timeout: timeoutDuration)); | 2581 '--use-blobs' |
2582 ]..addAll(arguments), | |
2583 timeout: timeoutDuration)); | |
2580 } else { | 2584 } else { |
2581 steps.add(() => device.runAdbShellCommand( | 2585 steps.add(() => device.runAdbShellCommand( |
2582 ['$devicedir/dart_precompiled_runtime', | 2586 [ |
2583 '--run-app-snapshot=$deviceTestDir' | 2587 '$devicedir/dart_precompiled_runtime', |
2584 ]..addAll(arguments), | 2588 '--run-app-snapshot=$deviceTestDir' |
2585 timeout: timeoutDuration)); | 2589 ]..addAll(arguments), |
2590 timeout: timeoutDuration)); | |
2586 } | 2591 } |
2587 | 2592 |
2588 var stopwatch = new Stopwatch()..start(); | 2593 var stopwatch = new Stopwatch()..start(); |
2589 var writer = new StringBuffer(); | 2594 var writer = new StringBuffer(); |
2590 | 2595 |
2591 await device.waitForBootCompleted(); | 2596 await device.waitForBootCompleted(); |
2592 await device.waitForDevice(); | 2597 await device.waitForDevice(); |
2593 | 2598 |
2594 AdbCommandResult result; | 2599 AdbCommandResult result; |
2595 for (var i = 0; i < steps.length; i++) { | 2600 for (var i = 0; i < steps.length; i++) { |
2596 var fun = steps[i]; | 2601 var fun = steps[i]; |
2597 var commandStopwatch = new Stopwatch()..start(); | 2602 var commandStopwatch = new Stopwatch()..start(); |
2598 result = await fun(); | 2603 result = await fun(); |
2599 | 2604 |
2600 writer.writeln("Executing ${result.command}"); | 2605 writer.writeln("Executing ${result.command}"); |
2601 if (result.stdout.length > 0) { | 2606 if (result.stdout.length > 0) { |
2602 writer.writeln("Stdout:\n${result.stdout.trim()}"); | 2607 writer.writeln("Stdout:\n${result.stdout.trim()}"); |
2603 } | 2608 } |
2604 if (result.stderr.length > 0) { | 2609 if (result.stderr.length > 0) { |
2605 writer.writeln("Stderr:\n${result.stderr.trim()}"); | 2610 writer.writeln("Stderr:\n${result.stderr.trim()}"); |
2606 } | 2611 } |
2607 writer.writeln("ExitCode: ${result.exitCode}"); | 2612 writer.writeln("ExitCode: ${result.exitCode}"); |
2608 writer.writeln("Time: ${commandStopwatch.elapsed}"); | 2613 writer.writeln("Time: ${commandStopwatch.elapsed}"); |
2609 writer.writeln(""); | 2614 writer.writeln(""); |
2610 | 2615 |
2611 // If one command fails, we stop processing the others and return | 2616 // If one command fails, we stop processing the others and return |
2612 // immediately. | 2617 // immediately. |
2613 if (result.exitCode != 0) break; | 2618 if (result.exitCode != 0) break; |
2614 } | 2619 } |
2615 return createCommandOutput( | 2620 return createCommandOutput(command, result.exitCode, result.timedOut, |
2616 command, result.exitCode, result.timedOut, UTF8.encode('$writer'), | 2621 UTF8.encode('$writer'), [], stopwatch.elapsed, false); |
2617 [], stopwatch.elapsed, false); | |
2618 } | 2622 } |
2619 | 2623 |
2620 BatchRunnerProcess _getBatchRunner(String identifier) { | 2624 BatchRunnerProcess _getBatchRunner(String identifier) { |
2621 // Start batch processes if needed | 2625 // Start batch processes if needed |
2622 var runners = _batchProcesses[identifier]; | 2626 var runners = _batchProcesses[identifier]; |
2623 if (runners == null) { | 2627 if (runners == null) { |
2624 runners = new List<BatchRunnerProcess>(maxProcesses); | 2628 runners = new List<BatchRunnerProcess>(maxProcesses); |
2625 for (int i = 0; i < maxProcesses; i++) { | 2629 for (int i = 0; i < maxProcesses; i++) { |
2626 runners[i] = new BatchRunnerProcess(); | 2630 runners[i] = new BatchRunnerProcess(); |
2627 } | 2631 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2963 var commandEnqueuer = new CommandEnqueuer(_graph); | 2967 var commandEnqueuer = new CommandEnqueuer(_graph); |
2964 | 2968 |
2965 // CommandExecutor will execute commands | 2969 // CommandExecutor will execute commands |
2966 var executor; | 2970 var executor; |
2967 if (recording) { | 2971 if (recording) { |
2968 executor = new RecordingCommandExecutor(new Path(recordingOutputFile)); | 2972 executor = new RecordingCommandExecutor(new Path(recordingOutputFile)); |
2969 } else if (replaying) { | 2973 } else if (replaying) { |
2970 executor = new ReplayingCommandExecutor(new Path(recordedInputFile)); | 2974 executor = new ReplayingCommandExecutor(new Path(recordedInputFile)); |
2971 } else { | 2975 } else { |
2972 executor = new CommandExecutorImpl( | 2976 executor = new CommandExecutorImpl( |
2973 _globalConfiguration, maxProcesses, | 2977 _globalConfiguration, maxProcesses, maxBrowserProcesses, |
2974 maxBrowserProcesses, adbDevicePool: adbDevicePool); | 2978 adbDevicePool: adbDevicePool); |
2975 } | 2979 } |
2976 | 2980 |
2977 // Run "runnable commands" using [executor] subject to | 2981 // Run "runnable commands" using [executor] subject to |
2978 // maxProcesses/maxBrowserProcesses constraint | 2982 // maxProcesses/maxBrowserProcesses constraint |
2979 commandQueue = new CommandQueue(_graph, testCaseEnqueuer, executor, | 2983 commandQueue = new CommandQueue(_graph, testCaseEnqueuer, executor, |
2980 maxProcesses, maxBrowserProcesses, verbose); | 2984 maxProcesses, maxBrowserProcesses, verbose); |
2981 | 2985 |
2982 // Finish test cases when all commands were run (or some failed) | 2986 // Finish test cases when all commands were run (or some failed) |
2983 var testCaseCompleter = | 2987 var testCaseCompleter = |
2984 new TestCaseCompleter(_graph, testCaseEnqueuer, commandQueue); | 2988 new TestCaseCompleter(_graph, testCaseEnqueuer, commandQueue); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3040 } | 3044 } |
3041 } | 3045 } |
3042 | 3046 |
3043 void eventAllTestsDone() { | 3047 void eventAllTestsDone() { |
3044 for (var listener in _eventListener) { | 3048 for (var listener in _eventListener) { |
3045 listener.allDone(); | 3049 listener.allDone(); |
3046 } | 3050 } |
3047 _allDone(); | 3051 _allDone(); |
3048 } | 3052 } |
3049 } | 3053 } |
OLD | NEW |