Index: tools/testing/dart/test_runner.dart |
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
index 3a0b738fc6414600c864a895cf1fecbfd3c93fd4..9432c082870a69948001eb74b9b7874d5ce91161 100644 |
--- a/tools/testing/dart/test_runner.dart |
+++ b/tools/testing/dart/test_runner.dart |
@@ -601,6 +601,7 @@ class BatchRunnerProcess { |
List<String> _batchArguments; |
Process _process; |
+ bool _processDone = true; |
StringInputStream _stdoutStream; |
StringInputStream _stderrStream; |
@@ -609,6 +610,7 @@ class BatchRunnerProcess { |
List<String> _testStderr; |
bool _stdoutDrained = false; |
bool _stderrDrained = false; |
+ String _status; |
Date _startTime; |
Timer _timer; |
@@ -624,7 +626,7 @@ class BatchRunnerProcess { |
void startTest(TestCase testCase) { |
_currentTest = testCase; |
- if (_process === null) { |
+ if (_processDone) { |
// Start process if not yet started. |
_executable = testCase.commands.last().executable; |
_startProcess(() { |
@@ -693,7 +695,6 @@ class BatchRunnerProcess { |
} |
int _reportResult(String output) { |
- _stdoutDrained = true; |
// output = '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}' |
var outcome = output.split(" ")[2]; |
var exitCode = 0; |
@@ -704,13 +705,7 @@ class BatchRunnerProcess { |
// Move on when both stdout and stderr has been drained. If the test |
// crashed, we restarted the process and therefore do not attempt to |
// drain stderr. |
- if (_stderrDrained || (_currentTest.output.hasCrashed)) _testCompleted(); |
- } |
- |
- void _stderrDone() { |
- _stderrDrained = true; |
- // Move on when both stdout and stderr has been drained. |
- if (_stdoutDrained) _testCompleted(); |
+ if (_stderrDrained) _testCompleted(); |
} |
Function _readStdout(StringInputStream stream, List<String> buffer) { |
@@ -720,6 +715,7 @@ class BatchRunnerProcess { |
while (line != null) { |
if (line.startsWith('>>> TEST')) { |
status = line; |
+ _stdoutDrained = true; |
} else if (line.startsWith('>>> BATCH START')) { |
// ignore |
} else if (line.startsWith('>>> ')) { |
@@ -731,9 +727,12 @@ class BatchRunnerProcess { |
} |
if (status != null) { |
_timer.cancel(); |
- // For crashing processes, let the exit handler deal with it. |
- if (!status.contains("CRASH")) { |
+ this._status = status; |
+ if (_stderrDrained) { |
_reportResult(status); |
+ if (_processDone) { |
+ _startProcess(); |
+ } |
} |
} |
}; |
@@ -743,8 +742,15 @@ class BatchRunnerProcess { |
return () { |
var line = stream.readLine(); |
while (line != null) { |
+ var status; |
if (line.startsWith('>>> EOF STDERR')) { |
- _stderrDone(); |
+ _stderrDrained = true; |
+ if (_stdoutDrained) { |
+ _reportResult(this._status); |
+ if (_processDone) { |
+ _startProcess(); |
+ } |
+ } |
} else { |
buffer.add(line); |
} |
@@ -756,9 +762,10 @@ class BatchRunnerProcess { |
void _exitHandler(exitCode) { |
if (_timer != null) _timer.cancel(); |
_process.close(); |
- _startProcess(() { |
- _reportResult(">>> TEST CRASH"); |
- }); |
+ _processDone = true; |
+ if (_stdoutDrained && _stderrDrained) { |
+ _startProcess(); |
+ } |
} |
void _timeoutHandler(ignore) { |
@@ -771,8 +778,9 @@ class BatchRunnerProcess { |
_process.kill(); |
} |
- void _startProcess(then) { |
+ void _startProcess([then = null]) { |
_process = new Process.start(_executable, _batchArguments); |
+ _processDone = false; |
_stdoutStream = new StringInputStream(_process.stdout); |
_stderrStream = new StringInputStream(_process.stderr); |
_testStdout = new List<String>(); |