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

Unified Diff: tools/testing/dart/test_runner.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 2 months 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 00a2ebb9b4cecc854075f593e26cf25e288e6c78..7b1e5965389c7abc8ae48df392892cb83701b83c 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -221,6 +221,20 @@ class CompilationCommand extends ProcessCommand {
deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies);
}
+class KernelCompilationCommand extends CompilationCommand {
+ KernelCompilationCommand._(
+ String displayName,
+ String outputFile,
+ bool neverSkipCompilation,
+ List<Uri> bootstrapDependencies,
+ String executable,
+ List<String> arguments,
+ Map<String, String> environmentOverrides)
+ : super._(displayName, outputFile, neverSkipCompilation,
+ bootstrapDependencies, executable, arguments,
+ environmentOverrides);
+}
+
/// This is just a Pair(String, Map) class with hashCode and operator ==
class AddFlagsKey {
final String flags;
@@ -650,6 +664,25 @@ class CommandBuilder {
return _getUniqueCommand(command);
}
+ CompilationCommand getKernelCompilationCommand(
+ String displayName,
+ outputFile,
+ neverSkipCompilation,
+ List<Uri> bootstrapDependencies,
+ String executable,
+ List<String> arguments,
+ Map<String, String> environment) {
+ var command = new KernelCompilationCommand._(
+ displayName,
+ outputFile,
+ neverSkipCompilation,
+ bootstrapDependencies,
+ executable,
+ arguments,
+ environment);
+ return _getUniqueCommand(command);
+ }
+
AnalysisCommand getAnalysisCommand(
String displayName, executable, arguments, environmentOverrides,
{String flavor: 'dart2analyzer'}) {
@@ -1609,6 +1642,29 @@ class CompilationCommandOutputImpl extends CommandOutputImpl {
}
}
+class KernelCompilationCommandOutputImpl extends CompilationCommandOutputImpl {
+ KernelCompilationCommandOutputImpl(
+ Command command, int exitCode, bool timedOut,
+ List<int> stdout, List<int> stderr,
+ Duration time, bool compilationSkipped)
+ : super(command, exitCode, timedOut, stdout, stderr, time,
+ compilationSkipped);
+
+ bool get canRunDependendCommands {
+ // See [BatchRunnerProcess]: 0 means success, 1 means compile-time error.
+ // TODO(asgerf): When the frontend supports it, continue running even if
+ // there were compile-time errors. See kernel_sdk issue #18.
+ return !hasCrashed && !timedOut && exitCode == 0;
+ }
+
+ // If the compiler was able to produce a Kernel IR file we want to run the
+ // result on the Dart VM. We therefore mark the [KernelCompilationCommand] as
+ // successful.
+ // => This ensures we test that the DartVM produces correct CompileTime errors
+ // as it is supposed to for our test suites.
+ bool get successful => canRunDependendCommands;
+}
+
class JsCommandlineOutputImpl extends CommandOutputImpl
with UnittestSuiteMessagesMixin {
JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut,
@@ -1683,6 +1739,9 @@ CommandOutput createCommandOutput(Command command, int exitCode, bool timedOut,
} else if (command is VmCommand) {
return new VmCommandOutputImpl(
command, exitCode, timedOut, stdout, stderr, time, pid);
+ } else if (command is KernelCompilationCommand) {
+ return new KernelCompilationCommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
} else if (command is AdbPrecompilationCommand) {
return new VmCommandOutputImpl(
command, exitCode, timedOut, stdout, stderr, time, pid);
@@ -2549,6 +2608,12 @@ class CommandExecutorImpl implements CommandExecutor {
if (command is BrowserTestCommand) {
return _startBrowserControllerTest(command, timeout);
+ } else if (command is KernelCompilationCommand) {
+ // For now, we always run dartk in batch mode.
+ var name = command.displayName;
+ assert(name == 'dartk');
+ return _getBatchRunner(name)
+ .runCommand(name, command, timeout, command.arguments);
} else if (command is CompilationCommand && dart2jsBatchMode) {
return _getBatchRunner("dart2js")
.runCommand("dart2js", command, timeout, command.arguments);
« 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