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 bool _equal(VmCommand other) => | |
375 super._equal(other) && needsDFERunner == other.needsDFERunner; | |
kustermann
2017/01/31 15:39:00
whenever you overwrite _equal, also overwrite _bui
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
371 } | 376 } |
372 | 377 |
373 class VmBatchCommand extends ProcessCommand implements VmCommand { | 378 class VmBatchCommand extends ProcessCommand implements VmCommand { |
374 final String dartFile; | 379 final String dartFile; |
375 final bool checked; | 380 final bool checked; |
381 final needsDFERunner = false; | |
376 | 382 |
377 VmBatchCommand._(String executable, String dartFile, List<String> arguments, | 383 VmBatchCommand._(String executable, String dartFile, List<String> arguments, |
378 Map<String, String> environmentOverrides, {this.checked: true}) | 384 Map<String, String> environmentOverrides, {this.checked: true}) |
379 : this.dartFile = dartFile, | 385 : this.dartFile = dartFile, |
380 super._('vm-batch', executable, arguments, environmentOverrides); | 386 super._('vm-batch', executable, arguments, environmentOverrides); |
381 | 387 |
382 @override | 388 @override |
383 List<String> get batchArguments => checked | 389 List<String> get batchArguments => checked |
384 ? ['--checked', dartFile] | 390 ? ['--checked', dartFile] |
385 : [dartFile]; | 391 : [dartFile]; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 | 732 |
727 AnalysisCommand getAnalysisCommand( | 733 AnalysisCommand getAnalysisCommand( |
728 String displayName, executable, arguments, environmentOverrides, | 734 String displayName, executable, arguments, environmentOverrides, |
729 {String flavor: 'dart2analyzer'}) { | 735 {String flavor: 'dart2analyzer'}) { |
730 var command = new AnalysisCommand._( | 736 var command = new AnalysisCommand._( |
731 flavor, displayName, executable, arguments, environmentOverrides); | 737 flavor, displayName, executable, arguments, environmentOverrides); |
732 return _getUniqueCommand(command); | 738 return _getUniqueCommand(command); |
733 } | 739 } |
734 | 740 |
735 VmCommand getVmCommand(String executable, List<String> arguments, | 741 VmCommand getVmCommand(String executable, List<String> arguments, |
736 Map<String, String> environmentOverrides) { | 742 Map<String, String> environmentOverrides, {bool needsDFERunner: false}) { |
737 var command = new VmCommand._(executable, arguments, environmentOverrides); | 743 var command = new VmCommand._(executable, arguments, environmentOverrides, n eedsDFERunner); |
738 return _getUniqueCommand(command); | 744 return _getUniqueCommand(command); |
739 } | 745 } |
740 | 746 |
741 VmBatchCommand getVmBatchCommand(String executable, String tester, | 747 VmBatchCommand getVmBatchCommand(String executable, String tester, |
742 List<String> arguments, Map<String, String> environmentOverrides, | 748 List<String> arguments, Map<String, String> environmentOverrides, |
743 {bool checked: true}) { | 749 {bool checked: true}) { |
744 var command = | 750 var command = |
745 new VmBatchCommand._(executable, tester, arguments, environmentOverrides , | 751 new VmBatchCommand._(executable, tester, arguments, environmentOverrides , |
746 checked: checked); | 752 checked: checked); |
747 return _getUniqueCommand(command); | 753 return _getUniqueCommand(command); |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1585 outWarnings.add(fields[FORMATTED_ERROR]); | 1591 outWarnings.add(fields[FORMATTED_ERROR]); |
1586 } | 1592 } |
1587 // OK to Skip error output that doesn't match the machine format | 1593 // OK to Skip error output that doesn't match the machine format |
1588 } | 1594 } |
1589 } | 1595 } |
1590 } | 1596 } |
1591 } | 1597 } |
1592 | 1598 |
1593 class VmCommandOutputImpl extends CommandOutputImpl | 1599 class VmCommandOutputImpl extends CommandOutputImpl |
1594 with UnittestSuiteMessagesMixin { | 1600 with UnittestSuiteMessagesMixin { |
1601 static const DART_VM_EXITCODE_DFE_ERROR = 252; | |
1595 static const DART_VM_EXITCODE_COMPILE_TIME_ERROR = 254; | 1602 static const DART_VM_EXITCODE_COMPILE_TIME_ERROR = 254; |
1596 static const DART_VM_EXITCODE_UNCAUGHT_EXCEPTION = 255; | 1603 static const DART_VM_EXITCODE_UNCAUGHT_EXCEPTION = 255; |
1597 | 1604 |
1598 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, | 1605 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, |
1599 List<int> stdout, List<int> stderr, Duration time, int pid) | 1606 List<int> stdout, List<int> stderr, Duration time, int pid) |
1600 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); | 1607 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); |
1601 | 1608 |
1602 Expectation result(TestCase testCase) { | 1609 Expectation result(TestCase testCase) { |
1603 // Handle crashes and timeouts first | 1610 // Handle crashes and timeouts first |
1611 if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.DARTK_CRASH; | |
1604 if (hasCrashed) return Expectation.CRASH; | 1612 if (hasCrashed) return Expectation.CRASH; |
1605 if (hasTimedOut) return Expectation.TIMEOUT; | 1613 if (hasTimedOut) return Expectation.TIMEOUT; |
1606 | 1614 |
1607 // Multitests are handled specially | 1615 // Multitests are handled specially |
1608 if (testCase.expectCompileError) { | 1616 if (testCase.expectCompileError) { |
1609 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { | 1617 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
1610 return Expectation.PASS; | 1618 return Expectation.PASS; |
1611 } | 1619 } |
1612 return Expectation.MISSING_COMPILETIME_ERROR; | 1620 return Expectation.MISSING_COMPILETIME_ERROR; |
1613 } | 1621 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1908 int timeout; | 1916 int timeout; |
1909 bool timedOut = false; | 1917 bool timedOut = false; |
1910 DateTime startTime; | 1918 DateTime startTime; |
1911 Timer timeoutTimer; | 1919 Timer timeoutTimer; |
1912 int pid; | 1920 int pid; |
1913 OutputLog stdout = new OutputLog(); | 1921 OutputLog stdout = new OutputLog(); |
1914 OutputLog stderr = new OutputLog(); | 1922 OutputLog stderr = new OutputLog(); |
1915 List<String> diagnostics = <String>[]; | 1923 List<String> diagnostics = <String>[]; |
1916 bool compilationSkipped = false; | 1924 bool compilationSkipped = false; |
1917 Completer<CommandOutput> completer; | 1925 Completer<CommandOutput> completer; |
1926 List<String> preArguments; | |
1918 | 1927 |
1919 RunningProcess(this.command, this.timeout); | 1928 RunningProcess(this.command, this.timeout, {this.preArguments}); |
1920 | 1929 |
1921 Future<CommandOutput> run() { | 1930 Future<CommandOutput> run() { |
1922 completer = new Completer<CommandOutput>(); | 1931 completer = new Completer<CommandOutput>(); |
1923 startTime = new DateTime.now(); | 1932 startTime = new DateTime.now(); |
1924 _runCommand(); | 1933 _runCommand(); |
1925 return completer.future; | 1934 return completer.future; |
1926 } | 1935 } |
1927 | 1936 |
1928 void _runCommand() { | 1937 void _runCommand() { |
1929 command.outputIsUpToDate.then((bool isUpToDate) { | 1938 command.outputIsUpToDate.then((bool isUpToDate) { |
1930 if (isUpToDate) { | 1939 if (isUpToDate) { |
1931 compilationSkipped = true; | 1940 compilationSkipped = true; |
1932 _commandComplete(0); | 1941 _commandComplete(0); |
1933 } else { | 1942 } else { |
1934 var processEnvironment = _createProcessEnvironment(); | 1943 var processEnvironment = _createProcessEnvironment(); |
1944 var args = command.arguments; | |
1945 if (preArguments != null) { | |
1946 args = []..addAll(preArguments)..addAll(args); | |
1947 } | |
1935 Future processFuture = io.Process.start( | 1948 Future processFuture = io.Process.start( |
1936 command.executable, command.arguments, | 1949 command.executable, args, |
1937 environment: processEnvironment, | 1950 environment: processEnvironment, |
1938 workingDirectory: command.workingDirectory); | 1951 workingDirectory: command.workingDirectory); |
1939 processFuture.then((io.Process process) { | 1952 processFuture.then((io.Process process) { |
1940 StreamSubscription stdoutSubscription = | 1953 StreamSubscription stdoutSubscription = |
1941 _drainStream(process.stdout, stdout); | 1954 _drainStream(process.stdout, stdout); |
1942 StreamSubscription stderrSubscription = | 1955 StreamSubscription stderrSubscription = |
1943 _drainStream(process.stderr, stderr); | 1956 _drainStream(process.stderr, stderr); |
1944 | 1957 |
1945 var stdoutCompleter = new Completer(); | 1958 var stdoutCompleter = new Completer(); |
1946 var stderrCompleter = new Completer(); | 1959 var stderrCompleter = new Completer(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2080 } | 2093 } |
2081 } | 2094 } |
2082 for (var excludedEnvironmentVariable in EXCLUDED_ENVIRONMENT_VARIABLES) { | 2095 for (var excludedEnvironmentVariable in EXCLUDED_ENVIRONMENT_VARIABLES) { |
2083 environment.remove(excludedEnvironmentVariable); | 2096 environment.remove(excludedEnvironmentVariable); |
2084 } | 2097 } |
2085 | 2098 |
2086 return environment; | 2099 return environment; |
2087 } | 2100 } |
2088 } | 2101 } |
2089 | 2102 |
2090 class BatchRunnerProcess { | 2103 |
kustermann
2017/01/31 15:39:00
one new line is enough
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2104 class BatchRunnerProcess { | |
2091 Completer<CommandOutput> _completer; | 2105 Completer<CommandOutput> _completer; |
2092 ProcessCommand _command; | 2106 ProcessCommand _command; |
2093 List<String> _arguments; | 2107 List<String> _arguments; |
2094 String _runnerType; | 2108 String _runnerType; |
2095 | 2109 |
2096 io.Process _process; | 2110 io.Process _process; |
2097 Map _processEnvironmentOverrides; | 2111 Map _processEnvironmentOverrides; |
2098 Completer _stdoutCompleter; | 2112 Completer _stdoutCompleter; |
2099 Completer _stderrCompleter; | 2113 Completer _stderrCompleter; |
2100 StreamSubscription<String> _stdoutSubscription; | 2114 StreamSubscription<String> _stdoutSubscription; |
2101 StreamSubscription<String> _stderrSubscription; | 2115 StreamSubscription<String> _stderrSubscription; |
2102 Function _processExitHandler; | 2116 Function _processExitHandler; |
2103 | 2117 |
2104 bool _currentlyRunning = false; | 2118 bool _currentlyRunning = false; |
2105 OutputLog _testStdout; | 2119 OutputLog _testStdout; |
2106 OutputLog _testStderr; | 2120 OutputLog _testStderr; |
2107 String _status; | 2121 String _status; |
2108 DateTime _startTime; | 2122 DateTime _startTime; |
2109 Timer _timer; | 2123 Timer _timer; |
2110 | 2124 |
2111 BatchRunnerProcess(); | |
2112 | |
2113 Future<CommandOutput> runCommand(String runnerType, ProcessCommand command, | 2125 Future<CommandOutput> runCommand(String runnerType, ProcessCommand command, |
2114 int timeout, List<String> arguments) { | 2126 int timeout, List<String> arguments) { |
2115 assert(_completer == null); | 2127 assert(_completer == null); |
2116 assert(!_currentlyRunning); | 2128 assert(!_currentlyRunning); |
2117 | 2129 |
2118 _completer = new Completer<CommandOutput>(); | 2130 _completer = new Completer<CommandOutput>(); |
2119 bool sameRunnerType = _runnerType == runnerType && | 2131 bool sameRunnerType = _runnerType == runnerType && |
2120 _dictEquals(_processEnvironmentOverrides, command.environmentOverrides); | 2132 _dictEquals(_processEnvironmentOverrides, command.environmentOverrides); |
2121 _runnerType = runnerType; | 2133 _runnerType = runnerType; |
2122 _currentlyRunning = true; | 2134 _currentlyRunning = true; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2299 bool _dictEquals(Map a, Map b) { | 2311 bool _dictEquals(Map a, Map b) { |
2300 if (a == null) return b == null; | 2312 if (a == null) return b == null; |
2301 if (b == null) return false; | 2313 if (b == null) return false; |
2302 for (var key in a.keys) { | 2314 for (var key in a.keys) { |
2303 if (a[key] != b[key]) return false; | 2315 if (a[key] != b[key]) return false; |
2304 } | 2316 } |
2305 return true; | 2317 return true; |
2306 } | 2318 } |
2307 } | 2319 } |
2308 | 2320 |
2321 class BatchDFEProcess { | |
2322 io.Process _process; | |
2323 int _port = -1; | |
2324 Function _processExitHandler; | |
2325 | |
2326 Completer terminating = null; | |
2327 | |
2328 bool locked = false; | |
2329 | |
2330 Future<int> acquire() async { | |
2331 try { | |
2332 assert(!locked); | |
2333 locked = true; | |
2334 if (_process == null) { | |
2335 await _startProcess(); | |
2336 } | |
2337 return _port; | |
2338 } catch(e) { | |
2339 locked = false; | |
2340 rethrow; | |
2341 } | |
2342 } | |
2343 | |
2344 void release() { | |
2345 locked = false; | |
2346 } | |
2347 | |
2348 Future terminate() { | |
2349 locked = true; | |
2350 if (_process == null) { | |
2351 return new Future.value(true); | |
2352 } | |
2353 if (terminating == null) { | |
2354 terminating = new Completer(); | |
2355 _process.kill(); | |
2356 } | |
2357 return terminating.future; | |
2358 } | |
2359 | |
2360 _onExit(exitCode) { | |
2361 if (terminating != null) { | |
2362 terminating.complete(); | |
2363 return; | |
2364 } | |
2365 | |
2366 _process = null; | |
2367 locked = false; | |
2368 _port = -1; | |
2369 } | |
2370 | |
2371 _startProcess() async { | |
kustermann
2017/01/31 15:39:00
Future
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2372 final executable = 'tools/dartk_wrappers/dfe_worker'; | |
2373 final arguments = []; | |
2374 | |
2375 try { | |
2376 _port = -1; | |
2377 _process = await io.Process.start(executable, arguments); | |
kustermann
2017/01/31 15:39:00
You can just use Platform.executable and 'tools/da
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2378 _process.exitCode.then(_onExit); | |
2379 | |
2380 final readyMsg = await _process.stdout.transform(UTF8.decoder).transform(n ew LineSplitter()).first; | |
kustermann
2017/01/31 15:39:00
long line
this will potentially crash the subproc
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2381 final data = readyMsg.split(' '); | |
2382 assert(data[0] == 'READY'); | |
kustermann
2017/01/31 15:39:00
Consider draining _process.stderr as well (maybe j
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2383 | |
2384 _port = int.parse(data[1]); | |
2385 } catch (e) { | |
2386 // TODO(floitsch): should we try to report the stacktrace? | |
kustermann
2017/01/31 15:39:00
floitsch :)
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2387 print("Process error:"); | |
2388 print(" Command: $executable ${arguments.join(' ')}"); | |
2389 print(" Error: $e"); | |
2390 // If there is an error starting a batch process, chances are that | |
2391 // it will always fail. So rather than re-trying a 1000+ times, we | |
2392 // exit. | |
2393 io.exit(1); | |
2394 return true; | |
2395 } | |
2396 } | |
2397 } | |
2398 | |
2309 /** | 2399 /** |
2310 * [TestCaseEnqueuer] takes a list of TestSuites, generates TestCases and | 2400 * [TestCaseEnqueuer] takes a list of TestSuites, generates TestCases and |
2311 * builds a dependency graph of all commands in every TestSuite. | 2401 * builds a dependency graph of all commands in every TestSuite. |
2312 * | 2402 * |
2313 * It will maintain three helper data structures | 2403 * It will maintain three helper data structures |
2314 * - command2node: A mapping from a [Command] to a node in the dependency graph | 2404 * - 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 | 2405 * - command2testCases: A mapping from [Command] to all TestCases that it is |
2316 * part of. | 2406 * part of. |
2317 * - remainingTestCases: A set of TestCases that were enqueued but are not | 2407 * - remainingTestCases: A set of TestCases that were enqueued but are not |
2318 * finished | 2408 * finished |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2607 final int maxProcesses; | 2697 final int maxProcesses; |
2608 final int maxBrowserProcesses; | 2698 final int maxBrowserProcesses; |
2609 AdbDevicePool adbDevicePool; | 2699 AdbDevicePool adbDevicePool; |
2610 | 2700 |
2611 // For dart2js and analyzer batch processing, | 2701 // For dart2js and analyzer batch processing, |
2612 // we keep a list of batch processes. | 2702 // we keep a list of batch processes. |
2613 final _batchProcesses = new Map<String, List<BatchRunnerProcess>>(); | 2703 final _batchProcesses = new Map<String, List<BatchRunnerProcess>>(); |
2614 // We keep a BrowserTestRunner for every configuration. | 2704 // We keep a BrowserTestRunner for every configuration. |
2615 final _browserTestRunners = new Map<Map, BrowserTestRunner>(); | 2705 final _browserTestRunners = new Map<Map, BrowserTestRunner>(); |
2616 | 2706 |
2707 List<BatchDFEProcess> _dfeProcesses = null; | |
2708 | |
2617 bool _finishing = false; | 2709 bool _finishing = false; |
2618 | 2710 |
2619 CommandExecutorImpl( | 2711 CommandExecutorImpl( |
2620 this.globalConfiguration, this.maxProcesses, this.maxBrowserProcesses, | 2712 this.globalConfiguration, this.maxProcesses, this.maxBrowserProcesses, |
2621 {this.adbDevicePool}); | 2713 {this.adbDevicePool}); |
2622 | 2714 |
2623 Future cleanup() { | 2715 Future cleanup() { |
2624 assert(!_finishing); | 2716 assert(!_finishing); |
2625 _finishing = true; | 2717 _finishing = true; |
2626 | 2718 |
2627 Future _terminateBatchRunners() { | 2719 Future _terminateBatchRunners() { |
2628 var futures = []; | 2720 var futures = []; |
2629 for (var runners in _batchProcesses.values) { | 2721 for (var runners in _batchProcesses.values) { |
2630 futures.addAll(runners.map((runner) => runner.terminate())); | 2722 futures.addAll(runners.map((runner) => runner.terminate())); |
2631 } | 2723 } |
2632 return Future.wait(futures); | 2724 return Future.wait(futures); |
2633 } | 2725 } |
2634 | 2726 |
2635 Future _terminateBrowserRunners() { | 2727 Future _terminateBrowserRunners() { |
2636 var futures = | 2728 var futures = |
2637 _browserTestRunners.values.map((runner) => runner.terminate()); | 2729 _browserTestRunners.values.map((runner) => runner.terminate()); |
2638 return Future.wait(futures); | 2730 return Future.wait(futures); |
2639 } | 2731 } |
2640 | 2732 |
2641 return Future.wait([_terminateBatchRunners(), _terminateBrowserRunners()]); | 2733 Future _terminateDFEWorkers() => |
2734 Future.wait((_dfeProcesses ?? []).map((p) => p.terminate())); | |
2735 | |
2736 return Future.wait([_terminateBatchRunners(), | |
2737 _terminateBrowserRunners(), | |
2738 _terminateDFEWorkers()]); | |
kustermann
2017/01/31 15:39:00
indentation
Vyacheslav Egorov (Google)
2017/01/31 17:06:56
Done.
| |
2642 } | 2739 } |
2643 | 2740 |
2644 Future<CommandOutput> runCommand(node, Command command, int timeout) { | 2741 Future<CommandOutput> runCommand(node, Command command, int timeout) { |
2645 assert(!_finishing); | 2742 assert(!_finishing); |
2646 | 2743 |
2647 Future<CommandOutput> runCommand(int retriesLeft) { | 2744 Future<CommandOutput> runCommand(int retriesLeft) { |
2648 return _runCommand(command, timeout).then((CommandOutput output) { | 2745 return _runCommand(command, timeout).then((CommandOutput output) { |
2649 if (retriesLeft > 0 && shouldRetryCommand(output)) { | 2746 if (retriesLeft > 0 && shouldRetryCommand(output)) { |
2650 DebugLogger.warning("Rerunning Command: ($retriesLeft " | 2747 DebugLogger.warning("Rerunning Command: ($retriesLeft " |
2651 "attempt(s) remains) [cmd: $command]"); | 2748 "attempt(s) remains) [cmd: $command]"); |
(...skipping 27 matching lines...) Expand all Loading... | |
2679 } else if (command is ScriptCommand) { | 2776 } else if (command is ScriptCommand) { |
2680 return command.run(); | 2777 return command.run(); |
2681 } else if (command is AdbPrecompilationCommand) { | 2778 } else if (command is AdbPrecompilationCommand) { |
2682 assert(adbDevicePool != null); | 2779 assert(adbDevicePool != null); |
2683 return adbDevicePool.acquireDevice().then((AdbDevice device) { | 2780 return adbDevicePool.acquireDevice().then((AdbDevice device) { |
2684 return _runAdbPrecompilationCommand(device, command, timeout) | 2781 return _runAdbPrecompilationCommand(device, command, timeout) |
2685 .whenComplete(() { | 2782 .whenComplete(() { |
2686 adbDevicePool.releaseDevice(device); | 2783 adbDevicePool.releaseDevice(device); |
2687 }); | 2784 }); |
2688 }); | 2785 }); |
2786 } else if (command is VmCommand && command.needsDFERunner) { | |
2787 final runner = _getDFEProcess(); | |
2788 return runner.acquire().then((port) { | |
2789 return new RunningProcess(command, timeout, preArguments: ['-DDFE_WORKER _PORT=${port}']).run(); | |
2790 }).whenComplete(() => runner.release()); | |
2689 } else if (command is VmBatchCommand) { | 2791 } else if (command is VmBatchCommand) { |
2690 var name = command.displayName; | 2792 var name = command.displayName; |
2691 return _getBatchRunner(command.displayName + command.dartFile) | 2793 return _getBatchRunner(command.displayName + command.dartFile) |
2692 .runCommand(name, command, timeout, command.arguments); | 2794 .runCommand(name, command, timeout, command.arguments); |
2693 } else { | 2795 } else { |
2694 return new RunningProcess(command, timeout).run(); | 2796 return new RunningProcess(command, timeout).run(); |
2695 } | 2797 } |
2696 } | 2798 } |
2697 | 2799 |
2698 Future<CommandOutput> _runAdbPrecompilationCommand( | 2800 Future<CommandOutput> _runAdbPrecompilationCommand( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2781 } | 2883 } |
2782 _batchProcesses[identifier] = runners; | 2884 _batchProcesses[identifier] = runners; |
2783 } | 2885 } |
2784 | 2886 |
2785 for (var runner in runners) { | 2887 for (var runner in runners) { |
2786 if (!runner._currentlyRunning) return runner; | 2888 if (!runner._currentlyRunning) return runner; |
2787 } | 2889 } |
2788 throw new Exception('Unable to find inactive batch runner.'); | 2890 throw new Exception('Unable to find inactive batch runner.'); |
2789 } | 2891 } |
2790 | 2892 |
2893 BatchDFEProcess _getDFEProcess() { | |
2894 _dfeProcesses ??= new List<BatchDFEProcess>.generate(maxProcesses, | |
2895 (_) => new BatchDFEProcess()); | |
2896 return _dfeProcesses.firstWhere((runner) => !runner.locked); | |
2897 } | |
2898 | |
2791 Future<CommandOutput> _startBrowserControllerTest( | 2899 Future<CommandOutput> _startBrowserControllerTest( |
2792 BrowserTestCommand browserCommand, int timeout) { | 2900 BrowserTestCommand browserCommand, int timeout) { |
2793 var completer = new Completer<CommandOutput>(); | 2901 var completer = new Completer<CommandOutput>(); |
2794 | 2902 |
2795 var callback = (BrowserTestOutput output) { | 2903 var callback = (BrowserTestOutput output) { |
2796 completer | 2904 completer |
2797 .complete(new BrowserControllerTestOutcome(browserCommand, output)); | 2905 .complete(new BrowserControllerTestOutcome(browserCommand, output)); |
2798 }; | 2906 }; |
2799 | 2907 |
2800 BrowserTest browserTest; | 2908 BrowserTest browserTest; |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3212 } | 3320 } |
3213 } | 3321 } |
3214 | 3322 |
3215 void eventAllTestsDone() { | 3323 void eventAllTestsDone() { |
3216 for (var listener in _eventListener) { | 3324 for (var listener in _eventListener) { |
3217 listener.allDone(); | 3325 listener.allDone(); |
3218 } | 3326 } |
3219 _allDone(); | 3327 _allDone(); |
3220 } | 3328 } |
3221 } | 3329 } |
OLD | NEW |