Chromium Code Reviews| 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..c68d72962ee2bdc5d62156665072e025ae951bba 100644 |
| --- a/tools/testing/dart/test_runner.dart |
| +++ b/tools/testing/dart/test_runner.dart |
| @@ -221,6 +221,38 @@ 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); |
| +} |
| + |
| +class KernelTransformationCommand extends CompilationCommand { |
| + final bool useBatchMode; |
| + |
| + KernelTransformationCommand._( |
| + String displayName, |
| + String outputFile, |
| + bool neverSkipCompilation, |
| + List<Uri> bootstrapDependencies, |
| + String executable, |
| + List<String> arguments, |
| + Map<String, String> environmentOverrides, |
| + this.useBatchMode) |
| + : super._(displayName, outputFile, neverSkipCompilation, |
| + bootstrapDependencies, executable, arguments, |
| + environmentOverrides); |
|
Bill Hesse
2016/10/21 12:17:39
Override operator == to include useBatchMode?
Vyacheslav Egorov (Google)
2016/10/21 13:39:44
I removed this class because it is not used anymor
|
| +} |
| + |
| + |
| /// This is just a Pair(String, Map) class with hashCode and operator == |
| class AddFlagsKey { |
| final String flags; |
| @@ -650,6 +682,45 @@ 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); |
| + } |
| + |
| + CompilationCommand getKernelTransformationCommand( |
| + String transformation, |
| + String executable, |
| + List<String> arguments, |
| + String outputFile, |
| + Map<String, String> environment, |
| + bool useBatchMode) { |
| + var command = new KernelTransformationCommand._( |
| + "kernel_transformation_$transformation", |
| + outputFile, |
| + false, |
| + const [], |
| + executable, |
| + arguments, |
| + environment, |
| + useBatchMode); |
| + return _getUniqueCommand(command); |
| + } |
| + |
| + |
| AnalysisCommand getAnalysisCommand( |
| String displayName, executable, arguments, environmentOverrides, |
| {String flavor: 'dart2analyzer'}) { |
| @@ -1609,6 +1680,44 @@ 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 KernelTransformationCommandOutputImpl extends CompilationCommandOutputImpl { |
| + KernelTransformationCommandOutputImpl( |
| + 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 { |
| + return !hasCrashed && !timedOut && exitCode == 0; |
| + } |
| + |
| + bool get successful => canRunDependendCommands; |
| +} |
| + |
| class JsCommandlineOutputImpl extends CommandOutputImpl |
| with UnittestSuiteMessagesMixin { |
| JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut, |
| @@ -1683,6 +1792,12 @@ 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 KernelTransformationCommand) { |
| + return new KernelTransformationCommandOutputImpl( |
| + command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); |
| } else if (command is AdbPrecompilationCommand) { |
| return new VmCommandOutputImpl( |
| command, exitCode, timedOut, stdout, stderr, time, pid); |
| @@ -2549,6 +2664,21 @@ class CommandExecutorImpl implements CommandExecutor { |
| if (command is BrowserTestCommand) { |
| return _startBrowserControllerTest(command, timeout); |
| + } else if (command is KernelTransformationCommand) { |
| + if (command.useBatchMode) { |
| + // For now, we always run transform.dart in batch mode (if we can). |
| + var name = command.displayName; |
| + return _getBatchRunner(name) |
| + .runCommand(name, command, timeout, command.arguments); |
| + } else { |
| + return new RunningProcess(command, timeout).run(); |
| + } |
| + } 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); |