Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 2451893004: Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."" (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 builder.addJson(_bootstrapDependencies); 214 builder.addJson(_bootstrapDependencies);
215 } 215 }
216 216
217 bool _equal(CompilationCommand other) => 217 bool _equal(CompilationCommand other) =>
218 super._equal(other) && 218 super._equal(other) &&
219 _outputFile == other._outputFile && 219 _outputFile == other._outputFile &&
220 _neverSkipCompilation == other._neverSkipCompilation && 220 _neverSkipCompilation == other._neverSkipCompilation &&
221 deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies); 221 deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies);
222 } 222 }
223 223
224 class KernelCompilationCommand extends CompilationCommand {
225 KernelCompilationCommand._(
226 String displayName,
227 String outputFile,
228 bool neverSkipCompilation,
229 List<Uri> bootstrapDependencies,
230 String executable,
231 List<String> arguments,
232 Map<String, String> environmentOverrides)
233 : super._(displayName, outputFile, neverSkipCompilation,
234 bootstrapDependencies, executable, arguments,
235 environmentOverrides);
236 }
237
238 /// This is just a Pair(String, Map) class with hashCode and operator == 224 /// This is just a Pair(String, Map) class with hashCode and operator ==
239 class AddFlagsKey { 225 class AddFlagsKey {
240 final String flags; 226 final String flags;
241 final Map env; 227 final Map env;
242 AddFlagsKey(this.flags, this.env); 228 AddFlagsKey(this.flags, this.env);
243 // Just use object identity for environment map 229 // Just use object identity for environment map
244 bool operator ==(other) => 230 bool operator ==(other) =>
245 other is AddFlagsKey && flags == other.flags && env == other.env; 231 other is AddFlagsKey && flags == other.flags && env == other.env;
246 int get hashCode => flags.hashCode ^ env.hashCode; 232 int get hashCode => flags.hashCode ^ env.hashCode;
247 } 233 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 displayName, 643 displayName,
658 outputFile, 644 outputFile,
659 neverSkipCompilation, 645 neverSkipCompilation,
660 bootstrapDependencies, 646 bootstrapDependencies,
661 executable, 647 executable,
662 arguments, 648 arguments,
663 environment); 649 environment);
664 return _getUniqueCommand(command); 650 return _getUniqueCommand(command);
665 } 651 }
666 652
667 CompilationCommand getKernelCompilationCommand(
668 String displayName,
669 outputFile,
670 neverSkipCompilation,
671 List<Uri> bootstrapDependencies,
672 String executable,
673 List<String> arguments,
674 Map<String, String> environment) {
675 var command = new KernelCompilationCommand._(
676 displayName,
677 outputFile,
678 neverSkipCompilation,
679 bootstrapDependencies,
680 executable,
681 arguments,
682 environment);
683 return _getUniqueCommand(command);
684 }
685
686 AnalysisCommand getAnalysisCommand( 653 AnalysisCommand getAnalysisCommand(
687 String displayName, executable, arguments, environmentOverrides, 654 String displayName, executable, arguments, environmentOverrides,
688 {String flavor: 'dart2analyzer'}) { 655 {String flavor: 'dart2analyzer'}) {
689 var command = new AnalysisCommand._( 656 var command = new AnalysisCommand._(
690 flavor, displayName, executable, arguments, environmentOverrides); 657 flavor, displayName, executable, arguments, environmentOverrides);
691 return _getUniqueCommand(command); 658 return _getUniqueCommand(command);
692 } 659 }
693 660
694 VmCommand getVmCommand(String executable, List<String> arguments, 661 VmCommand getVmCommand(String executable, List<String> arguments,
695 Map<String, String> environmentOverrides) { 662 Map<String, String> environmentOverrides) {
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 assert(exitCode != 0); 1602 assert(exitCode != 0);
1636 return Expectation.COMPILETIME_ERROR; 1603 return Expectation.COMPILETIME_ERROR;
1637 } 1604 }
1638 1605
1639 Expectation outcome = 1606 Expectation outcome =
1640 exitCode == 0 ? Expectation.PASS : Expectation.COMPILETIME_ERROR; 1607 exitCode == 0 ? Expectation.PASS : Expectation.COMPILETIME_ERROR;
1641 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); 1608 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative);
1642 } 1609 }
1643 } 1610 }
1644 1611
1645 class KernelCompilationCommandOutputImpl extends CompilationCommandOutputImpl {
1646 KernelCompilationCommandOutputImpl(
1647 Command command, int exitCode, bool timedOut,
1648 List<int> stdout, List<int> stderr,
1649 Duration time, bool compilationSkipped)
1650 : super(command, exitCode, timedOut, stdout, stderr, time,
1651 compilationSkipped);
1652
1653 bool get canRunDependendCommands {
1654 // See [BatchRunnerProcess]: 0 means success, 1 means compile-time error.
1655 // TODO(asgerf): When the frontend supports it, continue running even if
1656 // there were compile-time errors. See kernel_sdk issue #18.
1657 return !hasCrashed && !timedOut && exitCode == 0;
1658 }
1659
1660 // If the compiler was able to produce a Kernel IR file we want to run the
1661 // result on the Dart VM. We therefore mark the [KernelCompilationCommand] as
1662 // successful.
1663 // => This ensures we test that the DartVM produces correct CompileTime errors
1664 // as it is supposed to for our test suites.
1665 bool get successful => canRunDependendCommands;
1666 }
1667
1668 class JsCommandlineOutputImpl extends CommandOutputImpl 1612 class JsCommandlineOutputImpl extends CommandOutputImpl
1669 with UnittestSuiteMessagesMixin { 1613 with UnittestSuiteMessagesMixin {
1670 JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut, 1614 JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut,
1671 List<int> stdout, List<int> stderr, Duration time) 1615 List<int> stdout, List<int> stderr, Duration time)
1672 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0); 1616 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0);
1673 1617
1674 Expectation result(TestCase testCase) { 1618 Expectation result(TestCase testCase) {
1675 // Handle crashes and timeouts first 1619 // Handle crashes and timeouts first
1676 if (hasCrashed) return Expectation.CRASH; 1620 if (hasCrashed) return Expectation.CRASH;
1677 if (hasTimedOut) return Expectation.TIMEOUT; 1621 if (hasTimedOut) return Expectation.TIMEOUT;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1676 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1733 } else if (command is BrowserTestCommand) { 1677 } else if (command is BrowserTestCommand) {
1734 return new HTMLBrowserCommandOutputImpl( 1678 return new HTMLBrowserCommandOutputImpl(
1735 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1679 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1736 } else if (command is AnalysisCommand) { 1680 } else if (command is AnalysisCommand) {
1737 return new AnalysisCommandOutputImpl( 1681 return new AnalysisCommandOutputImpl(
1738 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1682 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1739 } else if (command is VmCommand) { 1683 } else if (command is VmCommand) {
1740 return new VmCommandOutputImpl( 1684 return new VmCommandOutputImpl(
1741 command, exitCode, timedOut, stdout, stderr, time, pid); 1685 command, exitCode, timedOut, stdout, stderr, time, pid);
1742 } else if (command is KernelCompilationCommand) {
1743 return new KernelCompilationCommandOutputImpl(
1744 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1745 } else if (command is AdbPrecompilationCommand) { 1686 } else if (command is AdbPrecompilationCommand) {
1746 return new VmCommandOutputImpl( 1687 return new VmCommandOutputImpl(
1747 command, exitCode, timedOut, stdout, stderr, time, pid); 1688 command, exitCode, timedOut, stdout, stderr, time, pid);
1748 } else if (command is CompilationCommand) { 1689 } else if (command is CompilationCommand) {
1749 if (command.displayName == 'precompiler' || 1690 if (command.displayName == 'precompiler' ||
1750 command.displayName == 'dart2snapshot') { 1691 command.displayName == 'dart2snapshot') {
1751 return new VmCommandOutputImpl( 1692 return new VmCommandOutputImpl(
1752 command, exitCode, timedOut, stdout, stderr, time, pid); 1693 command, exitCode, timedOut, stdout, stderr, time, pid);
1753 } 1694 }
1754 return new CompilationCommandOutputImpl( 1695 return new CompilationCommandOutputImpl(
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 } 2542 }
2602 return runCommand(command.maxNumRetries); 2543 return runCommand(command.maxNumRetries);
2603 } 2544 }
2604 2545
2605 Future<CommandOutput> _runCommand(Command command, int timeout) { 2546 Future<CommandOutput> _runCommand(Command command, int timeout) {
2606 var batchMode = !globalConfiguration['noBatch']; 2547 var batchMode = !globalConfiguration['noBatch'];
2607 var dart2jsBatchMode = globalConfiguration['dart2js_batch']; 2548 var dart2jsBatchMode = globalConfiguration['dart2js_batch'];
2608 2549
2609 if (command is BrowserTestCommand) { 2550 if (command is BrowserTestCommand) {
2610 return _startBrowserControllerTest(command, timeout); 2551 return _startBrowserControllerTest(command, timeout);
2611 } else if (command is KernelCompilationCommand) {
2612 // For now, we always run dartk in batch mode.
2613 var name = command.displayName;
2614 assert(name == 'dartk');
2615 return _getBatchRunner(name)
2616 .runCommand(name, command, timeout, command.arguments);
2617 } else if (command is CompilationCommand && dart2jsBatchMode) { 2552 } else if (command is CompilationCommand && dart2jsBatchMode) {
2618 return _getBatchRunner("dart2js") 2553 return _getBatchRunner("dart2js")
2619 .runCommand("dart2js", command, timeout, command.arguments); 2554 .runCommand("dart2js", command, timeout, command.arguments);
2620 } else if (command is AnalysisCommand && batchMode) { 2555 } else if (command is AnalysisCommand && batchMode) {
2621 return _getBatchRunner(command.flavor) 2556 return _getBatchRunner(command.flavor)
2622 .runCommand(command.flavor, command, timeout, command.arguments); 2557 .runCommand(command.flavor, command, timeout, command.arguments);
2623 } else if (command is ScriptCommand) { 2558 } else if (command is ScriptCommand) {
2624 return command.run(); 2559 return command.run();
2625 } else if (command is AdbPrecompilationCommand) { 2560 } else if (command is AdbPrecompilationCommand) {
2626 assert(adbDevicePool != null); 2561 assert(adbDevicePool != null);
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3139 } 3074 }
3140 } 3075 }
3141 3076
3142 void eventAllTestsDone() { 3077 void eventAllTestsDone() {
3143 for (var listener in _eventListener) { 3078 for (var listener in _eventListener) {
3144 listener.allDone(); 3079 listener.allDone();
3145 } 3080 }
3146 _allDone(); 3081 _allDone();
3147 } 3082 }
3148 } 3083 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698