| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
| 7 * | 7 * |
| 8 * This module includes: | 8 * This module includes: |
| 9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
| 10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 environment: processEnvironment); | 1355 environment: processEnvironment); |
| 1356 processFuture.then((io.Process process) { | 1356 processFuture.then((io.Process process) { |
| 1357 // Close stdin so that tests that try to block on input will fail. | 1357 // Close stdin so that tests that try to block on input will fail. |
| 1358 process.stdin.close(); | 1358 process.stdin.close(); |
| 1359 void timeoutHandler() { | 1359 void timeoutHandler() { |
| 1360 timedOut = true; | 1360 timedOut = true; |
| 1361 if (process != null) { | 1361 if (process != null) { |
| 1362 process.kill(); | 1362 process.kill(); |
| 1363 } | 1363 } |
| 1364 } | 1364 } |
| 1365 process.exitCode.then(_commandComplete); | 1365 Future.wait([process.exitCode, |
| 1366 _drainStream(process.stdout, stdout); | 1366 _drainStream(process.stdout, stdout), |
| 1367 _drainStream(process.stderr, stderr); | 1367 _drainStream(process.stderr, stderr)]) |
| 1368 .then((values) => _commandComplete(values[0])); |
| 1368 timeoutTimer = new Timer(new Duration(seconds: timeout), | 1369 timeoutTimer = new Timer(new Duration(seconds: timeout), |
| 1369 timeoutHandler); | 1370 timeoutHandler); |
| 1370 }).catchError((e) { | 1371 }).catchError((e) { |
| 1371 // TODO(floitsch): should we try to report the stacktrace? | 1372 // TODO(floitsch): should we try to report the stacktrace? |
| 1372 print("Process error:"); | 1373 print("Process error:"); |
| 1373 print(" Command: $command"); | 1374 print(" Command: $command"); |
| 1374 print(" Error: $e"); | 1375 print(" Error: $e"); |
| 1375 _commandComplete(-1); | 1376 _commandComplete(-1); |
| 1376 return true; | 1377 return true; |
| 1377 }); | 1378 }); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1392 command, | 1393 command, |
| 1393 exitCode, | 1394 exitCode, |
| 1394 timedOut, | 1395 timedOut, |
| 1395 stdout, | 1396 stdout, |
| 1396 stderr, | 1397 stderr, |
| 1397 new DateTime.now().difference(startTime), | 1398 new DateTime.now().difference(startTime), |
| 1398 compilationSkipped); | 1399 compilationSkipped); |
| 1399 return commandOutput; | 1400 return commandOutput; |
| 1400 } | 1401 } |
| 1401 | 1402 |
| 1402 void _drainStream(Stream<List<int>> source, List<int> destination) { | 1403 Future _drainStream(Stream<List<int>> source, List<int> destination) { |
| 1403 source.listen(destination.addAll); | 1404 return source.listen(destination.addAll).asFuture(); |
| 1404 } | 1405 } |
| 1405 | 1406 |
| 1406 Map<String, String> _createProcessEnvironment() { | 1407 Map<String, String> _createProcessEnvironment() { |
| 1407 var environment = io.Platform.environment; | 1408 var environment = io.Platform.environment; |
| 1408 | 1409 |
| 1409 if (command.environmentOverrides != null) { | 1410 if (command.environmentOverrides != null) { |
| 1410 for (var key in command.environmentOverrides.keys) { | 1411 for (var key in command.environmentOverrides.keys) { |
| 1411 environment[key] = command.environmentOverrides[key]; | 1412 environment[key] = command.environmentOverrides[key]; |
| 1412 } | 1413 } |
| 1413 } | 1414 } |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 } | 2381 } |
| 2381 } | 2382 } |
| 2382 | 2383 |
| 2383 void eventAllTestsDone() { | 2384 void eventAllTestsDone() { |
| 2384 for (var listener in _eventListener) { | 2385 for (var listener in _eventListener) { |
| 2385 listener.allDone(); | 2386 listener.allDone(); |
| 2386 } | 2387 } |
| 2387 _allDone(); | 2388 _allDone(); |
| 2388 } | 2389 } |
| 2389 } | 2390 } |
| OLD | NEW |