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 4199c3d7901ed3d7feae73b209c1c58f822004a5..ba7e6feb30d00ed5d008711db478dc0c54e75d16 100644 |
| --- a/tools/testing/dart/test_runner.dart |
| +++ b/tools/testing/dart/test_runner.dart |
| @@ -22,7 +22,7 @@ final int NO_TIMEOUT = 0; |
| class TestCase { |
| String executablePath; |
| List<String> arguments; |
| - int timeout; |
| + Map configuration; |
| String commandLine; |
| String displayName; |
| TestOutput output; |
| @@ -33,19 +33,49 @@ class TestCase { |
| TestCase(this.displayName, |
| this.executablePath, |
| this.arguments, |
| - this.timeout, |
| + this.configuration, |
| this.completedHandler, |
| this.expectedOutcomes, |
| [this.isNegative = false]) { |
| if (!isNegative) { |
| this.isNegative = displayName.contains("NegativeTest"); |
| } |
| - commandLine = executablePath; |
| - for (var arg in arguments) { |
| - commandLine += " " + arg; |
| + commandLine = "$executablePath ${Strings.join(arguments, ' ')}"; |
| + |
| + // Special command handling. If a special command is specified |
| + // we have to completely rewrite the command that we are using. |
| + // We generate a new command-line that is the special command |
| + // where we replace '@' with the original command. |
| + var specialCommand = configuration['special-command']; |
| + if (!specialCommand.isEmpty()) { |
| + Expect.isTrue(specialCommand.contains('@'), |
| + "special-command must contain a '@' char"); |
| + var specialCommandSplit = specialCommand.split('@'); |
| + var prefix = specialCommandSplit[0]; |
| + var suffix = specialCommandSplit[1]; |
| + commandLine = '$prefix $commandLine $suffix'; |
| + var newArguments = []; |
| + if (prefix.length > 0) { |
| + var prefixSplit = prefix.split(' '); |
| + var newExcecutablePath = prefixSplit[0]; |
|
Bill Hesse
2011/12/07 13:14:14
newExecutablePath.
Mads Ager (google)
2011/12/07 13:23:02
Thanks. Done!
|
| + for (int i = 1; i < prefixSplit.length; i++) { |
| + var current = prefixSplit[i]; |
| + if (!current.isEmpty()) newArguments.add(current); |
| + } |
| + newArguments.add(executablePath); |
| + executablePath = newExcecutablePath; |
| + } |
| + newArguments.addAll(arguments); |
| + var suffixSplit = prefix.split(' '); |
|
Bill Hesse
2011/12/07 13:14:14
This will not handle arguments with embedded space
Mads Ager (google)
2011/12/07 13:23:02
At this point I don't think that can happen. All t
|
| + suffixSplit.forEach((e) { |
| + if (!e.isEmpty()) newArguments.add(e); |
| + }); |
| + arguments = newArguments; |
| } |
| } |
| + int get timeout() => configuration['timeout']; |
| + |
| void completed() { completedHandler(this); } |
| } |
| @@ -357,17 +387,11 @@ class ProcessQueue { |
| throw new Exception('Unable to find inactive batch runner.'); |
| } |
| - void _printTestCase(TestCase testCase) { |
| - var path = testCase.executablePath; |
| - var args = Strings.join(testCase.arguments, ' '); |
| - print('# $path $args'); |
| - } |
| - |
| void _tryRunTest() { |
| _checkDone(); |
| if (_numProcesses < _maxProcesses && !_tests.isEmpty()) { |
| TestCase test = _tests.removeFirst(); |
| - if (_verbose) _printTestCase(test); |
| + if (_verbose) print(test.commandLine); |
| _progress.start(test); |
| Function oldCallback = test.completedHandler; |
| Function wrapper = (TestCase test_arg) { |