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 bc6be6491449219ff5f13c0576efd72a2ab3e535..764ea9ee73de0a4425b77b1bf1ef2b110158e3cd 100644 |
| --- a/tools/testing/dart/test_runner.dart |
| +++ b/tools/testing/dart/test_runner.dart |
| @@ -139,7 +139,7 @@ class ProcessCommand extends Command { |
| (io.Platform.operatingSystem == 'windows') |
| ? env.write('set $key=${escapeCommandLineArgument(value)} & ') |
| : env.write('$key=${escapeCommandLineArgument(value)} ')); |
| - var command = ([executable]..addAll(arguments)) |
| + var command = ([executable]..addAll(batchArguments)..addAll(arguments)) |
| .map(escapeCommandLineArgument) |
| .join(' '); |
| if (workingDirectory != null) { |
| @@ -149,6 +149,11 @@ class ProcessCommand extends Command { |
| } |
| Future<bool> get outputIsUpToDate => new Future.value(false); |
| + |
| + /// Arguments that are passed to the process when starting batch mode. |
| + /// |
| + /// In non-batch mode, they should be passed before [arguments]. |
| + List<String> get batchArguments => const []; |
| } |
| class CompilationCommand extends ProcessCommand { |
| @@ -362,6 +367,34 @@ class VmCommand extends ProcessCommand { |
| : super._("vm", executable, arguments, environmentOverrides); |
| } |
| +class VmBatchCommand extends ProcessCommand implements VmCommand { |
|
kustermann
2016/12/06 10:39:05
If you make a [VmBatchCommandOutputImpl] as well f
asgerf
2016/12/06 13:42:08
I gave this a shot but couldn't make it work. The
|
| + final String dartFile; |
| + final bool checked; |
| + |
| + VmBatchCommand._(String executable, String dartFile, List<String> arguments, |
| + Map<String, String> environmentOverrides, {this.checked: true}) |
| + : this.dartFile = dartFile, |
| + super._('vm-batch', executable, arguments, environmentOverrides); |
| + |
| + @override |
| + List<String> get batchArguments => checked |
| + ? ['--checked', dartFile] |
| + : [dartFile]; |
| + |
| + @override |
| + bool _equal(Command other) { |
| + return super._equal(other) && |
| + other is VmBatchCommand && |
|
kustermann
2016/12/06 10:39:05
The "other is VmBatchCommand" is unnecessary I thi
asgerf
2016/12/06 13:42:08
Done.
I also added 'checked' to the comparison be
|
| + dartFile == other.dartFile; |
| + } |
| + |
| + @override |
| + void _buildHashCode(HashCodeBuilder builder) { |
| + super._buildHashCode(builder); |
| + builder.addJson(dartFile); |
| + } |
| +} |
| + |
| class AdbPrecompilationCommand extends Command { |
| final String precompiledRunnerFilename; |
| final String processTestFilename; |
| @@ -701,6 +734,15 @@ class CommandBuilder { |
| return _getUniqueCommand(command); |
| } |
| + VmBatchCommand getVmBatchCommand(String executable, String tester, |
| + List<String> arguments, Map<String, String> environmentOverrides, |
| + {bool checked: true}) { |
| + var command = |
| + new VmBatchCommand._(executable, tester, arguments, environmentOverrides, |
| + checked: checked); |
| + return _getUniqueCommand(command); |
| + } |
| + |
| AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner, |
| String processTest, |
| String testDirectory, |
| @@ -848,7 +890,7 @@ class TestCase extends UniqueObject { |
| bool get expectCompileError => _expectations & EXPECT_COMPILE_ERROR != 0; |
| bool get unexpectedOutput { |
| - var outcome = lastCommandOutput.result(this); |
| + var outcome = this.result; |
| return !expectedOutcomes.any((expectation) { |
| return outcome.canBeOutcomeOf(expectation); |
| }); |
| @@ -2181,7 +2223,7 @@ class BatchRunnerProcess { |
| _startProcess(callback) { |
| assert(_command is ProcessCommand); |
| var executable = _command.executable; |
| - var arguments = ['--batch']; |
| + var arguments = []..addAll(_command.batchArguments)..add('--batch'); |
| var environment = new Map.from(io.Platform.environment); |
| if (_processEnvironmentOverrides != null) { |
| for (var key in _processEnvironmentOverrides.keys) { |
| @@ -2642,6 +2684,10 @@ class CommandExecutorImpl implements CommandExecutor { |
| adbDevicePool.releaseDevice(device); |
| }); |
| }); |
| + } else if (command is VmBatchCommand) { |
| + var name = command.displayName; |
| + return _getBatchRunner(command.displayName + command.dartFile) |
| + .runCommand(name, command, timeout, command.arguments); |
| } else { |
| return new RunningProcess(command, timeout).run(); |
| } |