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

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

Issue 9109012: Fix static type warnings in test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months 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 | « tools/testing/dart/test_progress.dart ('k') | 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 void compilerExitHandler(int exitCode) { 187 void compilerExitHandler(int exitCode) {
188 if (exitCode != 0) { 188 if (exitCode != 0) {
189 exitHandler(exitCode); 189 exitHandler(exitCode);
190 } else { 190 } else {
191 process.close(); 191 process.close();
192 runCommand(testCase.executablePath, testCase.arguments, exitHandler); 192 runCommand(testCase.executablePath, testCase.arguments, exitHandler);
193 } 193 }
194 } 194 }
195 195
196 void makeReadHandler(StringInputStream source, List<String> destination) { 196 Function makeReadHandler(StringInputStream source, List<String> destination) {
197 return () { 197 return () {
198 if (source.closed) return; // TODO(whesse): Remove when bug is fixed. 198 if (source.closed) return; // TODO(whesse): Remove when bug is fixed.
199 var line = source.readLine(); 199 var line = source.readLine();
200 while (null != line) { 200 while (null != line) {
201 destination.add(line); 201 destination.add(line);
202 line = source.readLine(); 202 line = source.readLine();
203 } 203 }
204 }; 204 };
205 } 205 }
206 206
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 243
244 class DartcBatchRunnerProcess { 244 class DartcBatchRunnerProcess {
245 String _executable; 245 String _executable;
246 246
247 Process _process; 247 Process _process;
248 StringInputStream _stdoutStream; 248 StringInputStream _stdoutStream;
249 StringInputStream _stderrStream; 249 StringInputStream _stderrStream;
250 250
251 TestCase _currentTest; 251 TestCase _currentTest;
252 StringBuffer _testStdout; 252 List<String> _testStdout;
253 StringBuffer _testStderr; 253 List<String> _testStderr;
254 Date _startTime; 254 Date _startTime;
255 Timer _timer; 255 Timer _timer;
256 256
257 DartcBatchRunnerProcess(String this._executable); 257 DartcBatchRunnerProcess(String this._executable);
258 258
259 bool get active() => _currentTest != null; 259 bool get active() => _currentTest != null;
260 260
261 void startTest(TestCase testCase) { 261 void startTest(TestCase testCase) {
262 _currentTest = testCase; 262 _currentTest = testCase;
263 if (_process === null) { 263 if (_process === null) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // output = '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}' 312 // output = '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}'
313 var outcome = output.split(" ")[2]; 313 var outcome = output.split(" ")[2];
314 var exitCode = 0; 314 var exitCode = 0;
315 if (outcome == "CRASH") exitCode = -10; 315 if (outcome == "CRASH") exitCode = -10;
316 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1; 316 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1;
317 new TestOutput(test, exitCode, outcome == "TIMEOUT", _testStdout, 317 new TestOutput(test, exitCode, outcome == "TIMEOUT", _testStdout,
318 _testStderr, new Date.now().difference(_startTime)); 318 _testStderr, new Date.now().difference(_startTime));
319 test.completed(); 319 test.completed();
320 } 320 }
321 321
322 void _readOutput(StringInputStream stream, List<String> buffer) { 322 Function _readOutput(StringInputStream stream, List<String> buffer) {
323 return () { 323 return () {
324 var status; 324 var status;
325 var line = stream.readLine(); 325 var line = stream.readLine();
326 // Drain the input stream to get the error output. 326 // Drain the input stream to get the error output.
327 while (line != null) { 327 while (line != null) {
328 if (line.startsWith('>>> TEST')) { 328 if (line.startsWith('>>> TEST')) {
329 status = line; 329 status = line;
330 } else if (line.startsWith('>>> BATCH START')) { 330 } else if (line.startsWith('>>> BATCH START')) {
331 // ignore 331 // ignore
332 } else if (line.startsWith('>>> ')) { 332 } else if (line.startsWith('>>> ')) {
(...skipping 14 matching lines...) Expand all
347 } 347 }
348 348
349 void _exitHandler(exitCode) { 349 void _exitHandler(exitCode) {
350 if (_timer != null) _timer.cancel(); 350 if (_timer != null) _timer.cancel();
351 _process.close(); 351 _process.close();
352 _startProcess(() { 352 _startProcess(() {
353 _reportResult(">>> TEST CRASH"); 353 _reportResult(">>> TEST CRASH");
354 }); 354 });
355 } 355 }
356 356
357 void _timeoutHandler(TestCase test) { 357 Function _timeoutHandler(TestCase test) {
358 return (ignore) { 358 return (ignore) {
359 _process.exitHandler = (exitCode) { 359 _process.exitHandler = (exitCode) {
360 _process.close(); 360 _process.close();
361 _startProcess(() { 361 _startProcess(() {
362 _reportResult(">>> TEST TIMEOUT"); 362 _reportResult(">>> TEST TIMEOUT");
363 }); 363 });
364 }; 364 };
365 _process.kill(); 365 _process.kill();
366 }; 366 };
367 } 367 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 test.displayName != 'dartc/junit_tests') { 484 test.displayName != 'dartc/junit_tests') {
485 _ensureDartcBatchRunnersStarted(test.executablePath); 485 _ensureDartcBatchRunnersStarted(test.executablePath);
486 _getDartcBatchRunnerProcess().startTest(test); 486 _getDartcBatchRunnerProcess().startTest(test);
487 } else { 487 } else {
488 new RunningProcess(test).start(); 488 new RunningProcess(test).start();
489 } 489 }
490 _numProcesses++; 490 _numProcesses++;
491 } 491 }
492 } 492 }
493 } 493 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698