| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void _buildHashCode(HashCodeBuilder builder) { | 358 void _buildHashCode(HashCodeBuilder builder) { |
| 359 super._buildHashCode(builder); | 359 super._buildHashCode(builder); |
| 360 builder.addJson(flavor); | 360 builder.addJson(flavor); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool _equal(AnalysisCommand other) => | 363 bool _equal(AnalysisCommand other) => |
| 364 super._equal(other) && flavor == other.flavor; | 364 super._equal(other) && flavor == other.flavor; |
| 365 } | 365 } |
| 366 | 366 |
| 367 class VmCommand extends ProcessCommand { | 367 class VmCommand extends ProcessCommand { |
| 368 final bool needsDFERunner; |
| 368 VmCommand._(String executable, List<String> arguments, | 369 VmCommand._(String executable, List<String> arguments, |
| 369 Map<String, String> environmentOverrides) | 370 Map<String, String> environmentOverrides, |
| 371 bool this.needsDFERunner) |
| 370 : super._("vm", executable, arguments, environmentOverrides); | 372 : super._("vm", executable, arguments, environmentOverrides); |
| 373 |
| 374 void _buildHashCode(HashCodeBuilder builder) { |
| 375 super._buildHashCode(builder); |
| 376 builder.add(needsDFERunner); |
| 377 } |
| 378 |
| 379 bool _equal(VmCommand other) => |
| 380 super._equal(other) && needsDFERunner == other.needsDFERunner; |
| 371 } | 381 } |
| 372 | 382 |
| 373 class VmBatchCommand extends ProcessCommand implements VmCommand { | 383 class VmBatchCommand extends ProcessCommand implements VmCommand { |
| 374 final String dartFile; | 384 final String dartFile; |
| 375 final bool checked; | 385 final bool checked; |
| 386 final needsDFERunner = false; |
| 376 | 387 |
| 377 VmBatchCommand._(String executable, String dartFile, List<String> arguments, | 388 VmBatchCommand._(String executable, String dartFile, List<String> arguments, |
| 378 Map<String, String> environmentOverrides, {this.checked: true}) | 389 Map<String, String> environmentOverrides, {this.checked: true}) |
| 379 : this.dartFile = dartFile, | 390 : this.dartFile = dartFile, |
| 380 super._('vm-batch', executable, arguments, environmentOverrides); | 391 super._('vm-batch', executable, arguments, environmentOverrides); |
| 381 | 392 |
| 382 @override | 393 @override |
| 383 List<String> get batchArguments => checked | 394 List<String> get batchArguments => checked |
| 384 ? ['--checked', dartFile] | 395 ? ['--checked', dartFile] |
| 385 : [dartFile]; | 396 : [dartFile]; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 737 |
| 727 AnalysisCommand getAnalysisCommand( | 738 AnalysisCommand getAnalysisCommand( |
| 728 String displayName, executable, arguments, environmentOverrides, | 739 String displayName, executable, arguments, environmentOverrides, |
| 729 {String flavor: 'dart2analyzer'}) { | 740 {String flavor: 'dart2analyzer'}) { |
| 730 var command = new AnalysisCommand._( | 741 var command = new AnalysisCommand._( |
| 731 flavor, displayName, executable, arguments, environmentOverrides); | 742 flavor, displayName, executable, arguments, environmentOverrides); |
| 732 return _getUniqueCommand(command); | 743 return _getUniqueCommand(command); |
| 733 } | 744 } |
| 734 | 745 |
| 735 VmCommand getVmCommand(String executable, List<String> arguments, | 746 VmCommand getVmCommand(String executable, List<String> arguments, |
| 736 Map<String, String> environmentOverrides) { | 747 Map<String, String> environmentOverrides, {bool needsDFERunner: false}) { |
| 737 var command = new VmCommand._(executable, arguments, environmentOverrides); | 748 var command = new VmCommand._(executable, arguments, environmentOverrides, n
eedsDFERunner); |
| 738 return _getUniqueCommand(command); | 749 return _getUniqueCommand(command); |
| 739 } | 750 } |
| 740 | 751 |
| 741 VmBatchCommand getVmBatchCommand(String executable, String tester, | 752 VmBatchCommand getVmBatchCommand(String executable, String tester, |
| 742 List<String> arguments, Map<String, String> environmentOverrides, | 753 List<String> arguments, Map<String, String> environmentOverrides, |
| 743 {bool checked: true}) { | 754 {bool checked: true}) { |
| 744 var command = | 755 var command = |
| 745 new VmBatchCommand._(executable, tester, arguments, environmentOverrides
, | 756 new VmBatchCommand._(executable, tester, arguments, environmentOverrides
, |
| 746 checked: checked); | 757 checked: checked); |
| 747 return _getUniqueCommand(command); | 758 return _getUniqueCommand(command); |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 outWarnings.add(fields[FORMATTED_ERROR]); | 1596 outWarnings.add(fields[FORMATTED_ERROR]); |
| 1586 } | 1597 } |
| 1587 // OK to Skip error output that doesn't match the machine format | 1598 // OK to Skip error output that doesn't match the machine format |
| 1588 } | 1599 } |
| 1589 } | 1600 } |
| 1590 } | 1601 } |
| 1591 } | 1602 } |
| 1592 | 1603 |
| 1593 class VmCommandOutputImpl extends CommandOutputImpl | 1604 class VmCommandOutputImpl extends CommandOutputImpl |
| 1594 with UnittestSuiteMessagesMixin { | 1605 with UnittestSuiteMessagesMixin { |
| 1606 static const DART_VM_EXITCODE_DFE_ERROR = 252; |
| 1595 static const DART_VM_EXITCODE_COMPILE_TIME_ERROR = 254; | 1607 static const DART_VM_EXITCODE_COMPILE_TIME_ERROR = 254; |
| 1596 static const DART_VM_EXITCODE_UNCAUGHT_EXCEPTION = 255; | 1608 static const DART_VM_EXITCODE_UNCAUGHT_EXCEPTION = 255; |
| 1597 | 1609 |
| 1598 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, | 1610 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, |
| 1599 List<int> stdout, List<int> stderr, Duration time, int pid) | 1611 List<int> stdout, List<int> stderr, Duration time, int pid) |
| 1600 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); | 1612 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); |
| 1601 | 1613 |
| 1602 Expectation result(TestCase testCase) { | 1614 Expectation result(TestCase testCase) { |
| 1603 // Handle crashes and timeouts first | 1615 // Handle crashes and timeouts first |
| 1616 if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.DARTK_CRASH; |
| 1604 if (hasCrashed) return Expectation.CRASH; | 1617 if (hasCrashed) return Expectation.CRASH; |
| 1605 if (hasTimedOut) return Expectation.TIMEOUT; | 1618 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1606 | 1619 |
| 1607 // Multitests are handled specially | 1620 // Multitests are handled specially |
| 1608 if (testCase.expectCompileError) { | 1621 if (testCase.expectCompileError) { |
| 1609 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { | 1622 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
| 1610 return Expectation.PASS; | 1623 return Expectation.PASS; |
| 1611 } | 1624 } |
| 1612 return Expectation.MISSING_COMPILETIME_ERROR; | 1625 return Expectation.MISSING_COMPILETIME_ERROR; |
| 1613 } | 1626 } |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 int timeout; | 1921 int timeout; |
| 1909 bool timedOut = false; | 1922 bool timedOut = false; |
| 1910 DateTime startTime; | 1923 DateTime startTime; |
| 1911 Timer timeoutTimer; | 1924 Timer timeoutTimer; |
| 1912 int pid; | 1925 int pid; |
| 1913 OutputLog stdout = new OutputLog(); | 1926 OutputLog stdout = new OutputLog(); |
| 1914 OutputLog stderr = new OutputLog(); | 1927 OutputLog stderr = new OutputLog(); |
| 1915 List<String> diagnostics = <String>[]; | 1928 List<String> diagnostics = <String>[]; |
| 1916 bool compilationSkipped = false; | 1929 bool compilationSkipped = false; |
| 1917 Completer<CommandOutput> completer; | 1930 Completer<CommandOutput> completer; |
| 1931 List<String> preArguments; |
| 1918 | 1932 |
| 1919 RunningProcess(this.command, this.timeout); | 1933 RunningProcess(this.command, this.timeout, {this.preArguments}); |
| 1920 | 1934 |
| 1921 Future<CommandOutput> run() { | 1935 Future<CommandOutput> run() { |
| 1922 completer = new Completer<CommandOutput>(); | 1936 completer = new Completer<CommandOutput>(); |
| 1923 startTime = new DateTime.now(); | 1937 startTime = new DateTime.now(); |
| 1924 _runCommand(); | 1938 _runCommand(); |
| 1925 return completer.future; | 1939 return completer.future; |
| 1926 } | 1940 } |
| 1927 | 1941 |
| 1928 void _runCommand() { | 1942 void _runCommand() { |
| 1929 command.outputIsUpToDate.then((bool isUpToDate) { | 1943 command.outputIsUpToDate.then((bool isUpToDate) { |
| 1930 if (isUpToDate) { | 1944 if (isUpToDate) { |
| 1931 compilationSkipped = true; | 1945 compilationSkipped = true; |
| 1932 _commandComplete(0); | 1946 _commandComplete(0); |
| 1933 } else { | 1947 } else { |
| 1934 var processEnvironment = _createProcessEnvironment(); | 1948 var processEnvironment = _createProcessEnvironment(); |
| 1949 var args = command.arguments; |
| 1950 if (preArguments != null) { |
| 1951 args = []..addAll(preArguments)..addAll(args); |
| 1952 } |
| 1935 Future processFuture = io.Process.start( | 1953 Future processFuture = io.Process.start( |
| 1936 command.executable, command.arguments, | 1954 command.executable, args, |
| 1937 environment: processEnvironment, | 1955 environment: processEnvironment, |
| 1938 workingDirectory: command.workingDirectory); | 1956 workingDirectory: command.workingDirectory); |
| 1939 processFuture.then((io.Process process) { | 1957 processFuture.then((io.Process process) { |
| 1940 StreamSubscription stdoutSubscription = | 1958 StreamSubscription stdoutSubscription = |
| 1941 _drainStream(process.stdout, stdout); | 1959 _drainStream(process.stdout, stdout); |
| 1942 StreamSubscription stderrSubscription = | 1960 StreamSubscription stderrSubscription = |
| 1943 _drainStream(process.stderr, stderr); | 1961 _drainStream(process.stderr, stderr); |
| 1944 | 1962 |
| 1945 var stdoutCompleter = new Completer(); | 1963 var stdoutCompleter = new Completer(); |
| 1946 var stderrCompleter = new Completer(); | 1964 var stderrCompleter = new Completer(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 } | 2098 } |
| 2081 } | 2099 } |
| 2082 for (var excludedEnvironmentVariable in EXCLUDED_ENVIRONMENT_VARIABLES) { | 2100 for (var excludedEnvironmentVariable in EXCLUDED_ENVIRONMENT_VARIABLES) { |
| 2083 environment.remove(excludedEnvironmentVariable); | 2101 environment.remove(excludedEnvironmentVariable); |
| 2084 } | 2102 } |
| 2085 | 2103 |
| 2086 return environment; | 2104 return environment; |
| 2087 } | 2105 } |
| 2088 } | 2106 } |
| 2089 | 2107 |
| 2090 class BatchRunnerProcess { | 2108 class BatchRunnerProcess { |
| 2091 Completer<CommandOutput> _completer; | 2109 Completer<CommandOutput> _completer; |
| 2092 ProcessCommand _command; | 2110 ProcessCommand _command; |
| 2093 List<String> _arguments; | 2111 List<String> _arguments; |
| 2094 String _runnerType; | 2112 String _runnerType; |
| 2095 | 2113 |
| 2096 io.Process _process; | 2114 io.Process _process; |
| 2097 Map _processEnvironmentOverrides; | 2115 Map _processEnvironmentOverrides; |
| 2098 Completer _stdoutCompleter; | 2116 Completer _stdoutCompleter; |
| 2099 Completer _stderrCompleter; | 2117 Completer _stderrCompleter; |
| 2100 StreamSubscription<String> _stdoutSubscription; | 2118 StreamSubscription<String> _stdoutSubscription; |
| 2101 StreamSubscription<String> _stderrSubscription; | 2119 StreamSubscription<String> _stderrSubscription; |
| 2102 Function _processExitHandler; | 2120 Function _processExitHandler; |
| 2103 | 2121 |
| 2104 bool _currentlyRunning = false; | 2122 bool _currentlyRunning = false; |
| 2105 OutputLog _testStdout; | 2123 OutputLog _testStdout; |
| 2106 OutputLog _testStderr; | 2124 OutputLog _testStderr; |
| 2107 String _status; | 2125 String _status; |
| 2108 DateTime _startTime; | 2126 DateTime _startTime; |
| 2109 Timer _timer; | 2127 Timer _timer; |
| 2110 | 2128 |
| 2111 BatchRunnerProcess(); | |
| 2112 | |
| 2113 Future<CommandOutput> runCommand(String runnerType, ProcessCommand command, | 2129 Future<CommandOutput> runCommand(String runnerType, ProcessCommand command, |
| 2114 int timeout, List<String> arguments) { | 2130 int timeout, List<String> arguments) { |
| 2115 assert(_completer == null); | 2131 assert(_completer == null); |
| 2116 assert(!_currentlyRunning); | 2132 assert(!_currentlyRunning); |
| 2117 | 2133 |
| 2118 _completer = new Completer<CommandOutput>(); | 2134 _completer = new Completer<CommandOutput>(); |
| 2119 bool sameRunnerType = _runnerType == runnerType && | 2135 bool sameRunnerType = _runnerType == runnerType && |
| 2120 _dictEquals(_processEnvironmentOverrides, command.environmentOverrides); | 2136 _dictEquals(_processEnvironmentOverrides, command.environmentOverrides); |
| 2121 _runnerType = runnerType; | 2137 _runnerType = runnerType; |
| 2122 _currentlyRunning = true; | 2138 _currentlyRunning = true; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 bool _dictEquals(Map a, Map b) { | 2315 bool _dictEquals(Map a, Map b) { |
| 2300 if (a == null) return b == null; | 2316 if (a == null) return b == null; |
| 2301 if (b == null) return false; | 2317 if (b == null) return false; |
| 2302 for (var key in a.keys) { | 2318 for (var key in a.keys) { |
| 2303 if (a[key] != b[key]) return false; | 2319 if (a[key] != b[key]) return false; |
| 2304 } | 2320 } |
| 2305 return true; | 2321 return true; |
| 2306 } | 2322 } |
| 2307 } | 2323 } |
| 2308 | 2324 |
| 2325 class BatchDFEProcess { |
| 2326 io.Process _process; |
| 2327 int _port = -1; |
| 2328 Function _processExitHandler; |
| 2329 |
| 2330 Completer terminating = null; |
| 2331 |
| 2332 bool locked = false; |
| 2333 |
| 2334 Future<int> acquire() async { |
| 2335 try { |
| 2336 assert(!locked); |
| 2337 locked = true; |
| 2338 if (_process == null) { |
| 2339 await _startProcess(); |
| 2340 } |
| 2341 return _port; |
| 2342 } catch(e) { |
| 2343 locked = false; |
| 2344 rethrow; |
| 2345 } |
| 2346 } |
| 2347 |
| 2348 void release() { |
| 2349 locked = false; |
| 2350 } |
| 2351 |
| 2352 Future terminate() { |
| 2353 locked = true; |
| 2354 if (_process == null) { |
| 2355 return new Future.value(true); |
| 2356 } |
| 2357 if (terminating == null) { |
| 2358 terminating = new Completer(); |
| 2359 _process.kill(); |
| 2360 } |
| 2361 return terminating.future; |
| 2362 } |
| 2363 |
| 2364 _onExit(exitCode) { |
| 2365 if (terminating != null) { |
| 2366 terminating.complete(); |
| 2367 return; |
| 2368 } |
| 2369 |
| 2370 _process = null; |
| 2371 locked = false; |
| 2372 _port = -1; |
| 2373 } |
| 2374 |
| 2375 static Future<String> _firstLine(stream) { |
| 2376 var completer = new Completer<String>(); |
| 2377 var first = true; |
| 2378 stream.transform(UTF8.decoder) |
| 2379 .transform(new LineSplitter()) |
| 2380 .listen((line) { |
| 2381 if (first) { |
| 2382 completer.complete(line); |
| 2383 first = false; |
| 2384 } |
| 2385 // We need to drain a pipe continuously. |
| 2386 }); |
| 2387 return completer.future; |
| 2388 } |
| 2389 |
| 2390 Future _startProcess() async { |
| 2391 final executable = io.Platform.executable; |
| 2392 final arguments = ['runtime/tools/kernel-service.dart', '--batch']; |
| 2393 |
| 2394 try { |
| 2395 _port = -1; |
| 2396 _process = await io.Process.start(executable, arguments); |
| 2397 _process.exitCode.then(_onExit); |
| 2398 _process.stderr.drain(); |
| 2399 |
| 2400 final readyMsg = await _firstLine(_process.stdout); |
| 2401 final data = readyMsg.split(' '); |
| 2402 assert(data[0] == 'READY'); |
| 2403 |
| 2404 _port = int.parse(data[1]); |
| 2405 } catch (e) { |
| 2406 print("Process error:"); |
| 2407 print(" Command: $executable ${arguments.join(' ')}"); |
| 2408 print(" Error: $e"); |
| 2409 // If there is an error starting a batch process, chances are that |
| 2410 // it will always fail. So rather than re-trying a 1000+ times, we |
| 2411 // exit. |
| 2412 io.exit(1); |
| 2413 return true; |
| 2414 } |
| 2415 } |
| 2416 } |
| 2417 |
| 2309 /** | 2418 /** |
| 2310 * [TestCaseEnqueuer] takes a list of TestSuites, generates TestCases and | 2419 * [TestCaseEnqueuer] takes a list of TestSuites, generates TestCases and |
| 2311 * builds a dependency graph of all commands in every TestSuite. | 2420 * builds a dependency graph of all commands in every TestSuite. |
| 2312 * | 2421 * |
| 2313 * It will maintain three helper data structures | 2422 * It will maintain three helper data structures |
| 2314 * - command2node: A mapping from a [Command] to a node in the dependency graph | 2423 * - command2node: A mapping from a [Command] to a node in the dependency graph |
| 2315 * - command2testCases: A mapping from [Command] to all TestCases that it is | 2424 * - command2testCases: A mapping from [Command] to all TestCases that it is |
| 2316 * part of. | 2425 * part of. |
| 2317 * - remainingTestCases: A set of TestCases that were enqueued but are not | 2426 * - remainingTestCases: A set of TestCases that were enqueued but are not |
| 2318 * finished | 2427 * finished |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 final int maxProcesses; | 2716 final int maxProcesses; |
| 2608 final int maxBrowserProcesses; | 2717 final int maxBrowserProcesses; |
| 2609 AdbDevicePool adbDevicePool; | 2718 AdbDevicePool adbDevicePool; |
| 2610 | 2719 |
| 2611 // For dart2js and analyzer batch processing, | 2720 // For dart2js and analyzer batch processing, |
| 2612 // we keep a list of batch processes. | 2721 // we keep a list of batch processes. |
| 2613 final _batchProcesses = new Map<String, List<BatchRunnerProcess>>(); | 2722 final _batchProcesses = new Map<String, List<BatchRunnerProcess>>(); |
| 2614 // We keep a BrowserTestRunner for every configuration. | 2723 // We keep a BrowserTestRunner for every configuration. |
| 2615 final _browserTestRunners = new Map<Map, BrowserTestRunner>(); | 2724 final _browserTestRunners = new Map<Map, BrowserTestRunner>(); |
| 2616 | 2725 |
| 2726 List<BatchDFEProcess> _dfeProcesses = null; |
| 2727 |
| 2617 bool _finishing = false; | 2728 bool _finishing = false; |
| 2618 | 2729 |
| 2619 CommandExecutorImpl( | 2730 CommandExecutorImpl( |
| 2620 this.globalConfiguration, this.maxProcesses, this.maxBrowserProcesses, | 2731 this.globalConfiguration, this.maxProcesses, this.maxBrowserProcesses, |
| 2621 {this.adbDevicePool}); | 2732 {this.adbDevicePool}); |
| 2622 | 2733 |
| 2623 Future cleanup() { | 2734 Future cleanup() { |
| 2624 assert(!_finishing); | 2735 assert(!_finishing); |
| 2625 _finishing = true; | 2736 _finishing = true; |
| 2626 | 2737 |
| 2627 Future _terminateBatchRunners() { | 2738 Future _terminateBatchRunners() { |
| 2628 var futures = []; | 2739 var futures = []; |
| 2629 for (var runners in _batchProcesses.values) { | 2740 for (var runners in _batchProcesses.values) { |
| 2630 futures.addAll(runners.map((runner) => runner.terminate())); | 2741 futures.addAll(runners.map((runner) => runner.terminate())); |
| 2631 } | 2742 } |
| 2632 return Future.wait(futures); | 2743 return Future.wait(futures); |
| 2633 } | 2744 } |
| 2634 | 2745 |
| 2635 Future _terminateBrowserRunners() { | 2746 Future _terminateBrowserRunners() { |
| 2636 var futures = | 2747 var futures = |
| 2637 _browserTestRunners.values.map((runner) => runner.terminate()); | 2748 _browserTestRunners.values.map((runner) => runner.terminate()); |
| 2638 return Future.wait(futures); | 2749 return Future.wait(futures); |
| 2639 } | 2750 } |
| 2640 | 2751 |
| 2641 return Future.wait([_terminateBatchRunners(), _terminateBrowserRunners()]); | 2752 Future _terminateDFEWorkers() => |
| 2753 Future.wait((_dfeProcesses ?? []).map((p) => p.terminate())); |
| 2754 |
| 2755 return Future.wait([ |
| 2756 _terminateBatchRunners(), |
| 2757 _terminateBrowserRunners(), |
| 2758 _terminateDFEWorkers() |
| 2759 ]); |
| 2642 } | 2760 } |
| 2643 | 2761 |
| 2644 Future<CommandOutput> runCommand(node, Command command, int timeout) { | 2762 Future<CommandOutput> runCommand(node, Command command, int timeout) { |
| 2645 assert(!_finishing); | 2763 assert(!_finishing); |
| 2646 | 2764 |
| 2647 Future<CommandOutput> runCommand(int retriesLeft) { | 2765 Future<CommandOutput> runCommand(int retriesLeft) { |
| 2648 return _runCommand(command, timeout).then((CommandOutput output) { | 2766 return _runCommand(command, timeout).then((CommandOutput output) { |
| 2649 if (retriesLeft > 0 && shouldRetryCommand(output)) { | 2767 if (retriesLeft > 0 && shouldRetryCommand(output)) { |
| 2650 DebugLogger.warning("Rerunning Command: ($retriesLeft " | 2768 DebugLogger.warning("Rerunning Command: ($retriesLeft " |
| 2651 "attempt(s) remains) [cmd: $command]"); | 2769 "attempt(s) remains) [cmd: $command]"); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2679 } else if (command is ScriptCommand) { | 2797 } else if (command is ScriptCommand) { |
| 2680 return command.run(); | 2798 return command.run(); |
| 2681 } else if (command is AdbPrecompilationCommand) { | 2799 } else if (command is AdbPrecompilationCommand) { |
| 2682 assert(adbDevicePool != null); | 2800 assert(adbDevicePool != null); |
| 2683 return adbDevicePool.acquireDevice().then((AdbDevice device) { | 2801 return adbDevicePool.acquireDevice().then((AdbDevice device) { |
| 2684 return _runAdbPrecompilationCommand(device, command, timeout) | 2802 return _runAdbPrecompilationCommand(device, command, timeout) |
| 2685 .whenComplete(() { | 2803 .whenComplete(() { |
| 2686 adbDevicePool.releaseDevice(device); | 2804 adbDevicePool.releaseDevice(device); |
| 2687 }); | 2805 }); |
| 2688 }); | 2806 }); |
| 2807 } else if (command is VmCommand && command.needsDFERunner) { |
| 2808 final runner = _getDFEProcess(); |
| 2809 return runner.acquire().then((port) { |
| 2810 return new RunningProcess(command, timeout, preArguments: ['-DDFE_WORKER
_PORT=${port}']).run(); |
| 2811 }).whenComplete(() => runner.release()); |
| 2689 } else if (command is VmBatchCommand) { | 2812 } else if (command is VmBatchCommand) { |
| 2690 var name = command.displayName; | 2813 var name = command.displayName; |
| 2691 return _getBatchRunner(command.displayName + command.dartFile) | 2814 return _getBatchRunner(command.displayName + command.dartFile) |
| 2692 .runCommand(name, command, timeout, command.arguments); | 2815 .runCommand(name, command, timeout, command.arguments); |
| 2693 } else { | 2816 } else { |
| 2694 return new RunningProcess(command, timeout).run(); | 2817 return new RunningProcess(command, timeout).run(); |
| 2695 } | 2818 } |
| 2696 } | 2819 } |
| 2697 | 2820 |
| 2698 Future<CommandOutput> _runAdbPrecompilationCommand( | 2821 Future<CommandOutput> _runAdbPrecompilationCommand( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 } | 2904 } |
| 2782 _batchProcesses[identifier] = runners; | 2905 _batchProcesses[identifier] = runners; |
| 2783 } | 2906 } |
| 2784 | 2907 |
| 2785 for (var runner in runners) { | 2908 for (var runner in runners) { |
| 2786 if (!runner._currentlyRunning) return runner; | 2909 if (!runner._currentlyRunning) return runner; |
| 2787 } | 2910 } |
| 2788 throw new Exception('Unable to find inactive batch runner.'); | 2911 throw new Exception('Unable to find inactive batch runner.'); |
| 2789 } | 2912 } |
| 2790 | 2913 |
| 2914 BatchDFEProcess _getDFEProcess() { |
| 2915 _dfeProcesses ??= new List<BatchDFEProcess>.generate(maxProcesses, |
| 2916 (_) => new BatchDFEProcess()); |
| 2917 return _dfeProcesses.firstWhere((runner) => !runner.locked); |
| 2918 } |
| 2919 |
| 2791 Future<CommandOutput> _startBrowserControllerTest( | 2920 Future<CommandOutput> _startBrowserControllerTest( |
| 2792 BrowserTestCommand browserCommand, int timeout) { | 2921 BrowserTestCommand browserCommand, int timeout) { |
| 2793 var completer = new Completer<CommandOutput>(); | 2922 var completer = new Completer<CommandOutput>(); |
| 2794 | 2923 |
| 2795 var callback = (BrowserTestOutput output) { | 2924 var callback = (BrowserTestOutput output) { |
| 2796 completer | 2925 completer |
| 2797 .complete(new BrowserControllerTestOutcome(browserCommand, output)); | 2926 .complete(new BrowserControllerTestOutcome(browserCommand, output)); |
| 2798 }; | 2927 }; |
| 2799 | 2928 |
| 2800 BrowserTest browserTest; | 2929 BrowserTest browserTest; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 } | 3341 } |
| 3213 } | 3342 } |
| 3214 | 3343 |
| 3215 void eventAllTestsDone() { | 3344 void eventAllTestsDone() { |
| 3216 for (var listener in _eventListener) { | 3345 for (var listener in _eventListener) { |
| 3217 listener.allDone(); | 3346 listener.allDone(); |
| 3218 } | 3347 } |
| 3219 _allDone(); | 3348 _allDone(); |
| 3220 } | 3349 } |
| 3221 } | 3350 } |
| OLD | NEW |