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

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 8931027: Fix read handler bug in tools/test.dart: Replace dataHandler with lineHandler if using readLine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("test_runner"); 5 #library("test_runner");
6 6
7 #import("status_file_parser.dart"); 7 #import("status_file_parser.dart");
8 #import("test_progress.dart"); 8 #import("test_progress.dart");
9 #import("test_suite.dart"); 9 #import("test_suite.dart");
10 10
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 List<String> arguments, 225 List<String> arguments,
226 void exitHandler(int exitCode)) { 226 void exitHandler(int exitCode)) {
227 process = new Process(executable, arguments); 227 process = new Process(executable, arguments);
228 process.exitHandler = exitHandler; 228 process.exitHandler = exitHandler;
229 startTime = new Date.now(); 229 startTime = new Date.now();
230 process.start(); 230 process.start();
231 InputStream stdoutStream = process.stdout; 231 InputStream stdoutStream = process.stdout;
232 InputStream stderrStream = process.stderr; 232 InputStream stderrStream = process.stderr;
233 StringInputStream stdoutStringStream = new StringInputStream(stdoutStream); 233 StringInputStream stdoutStringStream = new StringInputStream(stdoutStream);
234 StringInputStream stderrStringStream = new StringInputStream(stderrStream); 234 StringInputStream stderrStringStream = new StringInputStream(stderrStream);
235 stdoutStringStream.dataHandler = 235 stdoutStringStream.lineHandler =
236 makeReadHandler(stdoutStringStream, stdout); 236 makeReadHandler(stdoutStringStream, stdout);
237 stderrStringStream.dataHandler = 237 stderrStringStream.lineHandler =
238 makeReadHandler(stderrStringStream, stderr); 238 makeReadHandler(stderrStringStream, stderr);
239 timeoutTimer = new Timer(timeoutHandler, 1000 * testCase.timeout, false); 239 timeoutTimer = new Timer(timeoutHandler, 1000 * testCase.timeout, false);
240 } 240 }
241 241
242 void timeoutHandler(Timer unusedTimer) { 242 void timeoutHandler(Timer unusedTimer) {
243 timedOut = true; 243 timedOut = true;
244 process.kill(); 244 process.kill();
245 } 245 }
246 } 246 }
247 247
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 _process.exitHandler = (exitCode) { 285 _process.exitHandler = (exitCode) {
286 _process.close(); 286 _process.close();
287 }; 287 };
288 _process.kill(); 288 _process.kill();
289 } 289 }
290 290
291 void doStartTest(TestCase testCase) { 291 void doStartTest(TestCase testCase) {
292 _startTime = new Date.now(); 292 _startTime = new Date.now();
293 _testStdout = new List<String>(); 293 _testStdout = new List<String>();
294 _testStderr = new List<String>(); 294 _testStderr = new List<String>();
295 _stdoutStream.dataHandler = _readOutput(_stdoutStream, _testStdout); 295 _stdoutStream.lineHandler = _readOutput(_stdoutStream, _testStdout);
296 _stderrStream.dataHandler = _readOutput(_stderrStream, _testStderr); 296 _stderrStream.lineHandler = _readOutput(_stderrStream, _testStderr);
297 _timer = new Timer(_timeoutHandler(testCase), 297 _timer = new Timer(_timeoutHandler(testCase),
298 testCase.timeout * 1000, 298 testCase.timeout * 1000,
299 false); 299 false);
300 _process.stdin.write(_createArgumentsLine(testCase.arguments).charCodes()); 300 _process.stdin.write(_createArgumentsLine(testCase.arguments).charCodes());
301 } 301 }
302 302
303 String _createArgumentsLine(List<String> arguments) { 303 String _createArgumentsLine(List<String> arguments) {
304 return Strings.join(arguments, ' ') + '\n'; 304 return Strings.join(arguments, ' ') + '\n';
305 } 305 }
306 306
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 _process.kill(); 362 _process.kill();
363 }; 363 };
364 } 364 }
365 365
366 void _startProcess() { 366 void _startProcess() {
367 _process = new Process(_executable, ['-batch']); 367 _process = new Process(_executable, ['-batch']);
368 _stdoutStream = new StringInputStream(_process.stdout); 368 _stdoutStream = new StringInputStream(_process.stdout);
369 _stderrStream = new StringInputStream(_process.stderr); 369 _stderrStream = new StringInputStream(_process.stderr);
370 _testStdout = new List<String>(); 370 _testStdout = new List<String>();
371 _testStderr = new List<String>(); 371 _testStderr = new List<String>();
372 _stdoutStream.dataHandler = _readOutput(_stdoutStream, _testStdout); 372 _stdoutStream.lineHandler = _readOutput(_stdoutStream, _testStdout);
373 _stderrStream.dataHandler = _readOutput(_stderrStream, _testStderr); 373 _stderrStream.lineHandler = _readOutput(_stderrStream, _testStderr);
374 _process.exitHandler = _exitHandler; 374 _process.exitHandler = _exitHandler;
375 _process.start(); 375 _process.start();
376 } 376 }
377 } 377 }
378 378
379 379
380 class ProcessQueue { 380 class ProcessQueue {
381 int _numProcesses = 0; 381 int _numProcesses = 0;
382 int _activeTestListers = 0; 382 int _activeTestListers = 0;
383 int _maxProcesses; 383 int _maxProcesses;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if (test.configuration['component'] == 'dartc') { 472 if (test.configuration['component'] == 'dartc') {
473 _ensureDartcBatchRunnersStarted(test.executablePath); 473 _ensureDartcBatchRunnersStarted(test.executablePath);
474 _getDartcBatchRunnerProcess().startTest(test); 474 _getDartcBatchRunnerProcess().startTest(test);
475 } else { 475 } else {
476 new RunningProcess(test).start(); 476 new RunningProcess(test).start();
477 } 477 }
478 _numProcesses++; 478 _numProcesses++;
479 } 479 }
480 } 480 }
481 } 481 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698