| 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 if (process != null) { | 977 if (process != null) { |
| 978 process.kill(); | 978 process.kill(); |
| 979 } | 979 } |
| 980 } | 980 } |
| 981 process.exitCode.then(_commandComplete); | 981 process.exitCode.then(_commandComplete); |
| 982 _drainStream(process.stdout, stdout); | 982 _drainStream(process.stdout, stdout); |
| 983 _drainStream(process.stderr, stderr); | 983 _drainStream(process.stderr, stderr); |
| 984 timeoutTimer = new Timer(new Duration(seconds: testCase.timeout), | 984 timeoutTimer = new Timer(new Duration(seconds: testCase.timeout), |
| 985 timeoutHandler); | 985 timeoutHandler); |
| 986 }).catchError((e) { | 986 }).catchError((e) { |
| 987 // TODO(floitsch): should we try to report the stacktrace? |
| 987 print("Process error:"); | 988 print("Process error:"); |
| 988 print(" Command: $command"); | 989 print(" Command: $command"); |
| 989 print(" Error: $e"); | 990 print(" Error: $e"); |
| 990 _commandComplete(-1); | 991 _commandComplete(-1); |
| 991 return true; | 992 return true; |
| 992 }); | 993 }); |
| 993 } | 994 } |
| 994 }); | 995 }); |
| 995 } | 996 } |
| 996 | 997 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 }); | 1237 }); |
| 1237 | 1238 |
| 1238 _process.stdin.done.catchError((err) { | 1239 _process.stdin.done.catchError((err) { |
| 1239 print('Error on batch runner input stream stdin'); | 1240 print('Error on batch runner input stream stdin'); |
| 1240 print(' Previous test\'s status: $_status'); | 1241 print(' Previous test\'s status: $_status'); |
| 1241 print(' Error: $err'); | 1242 print(' Error: $err'); |
| 1242 throw err; | 1243 throw err; |
| 1243 }); | 1244 }); |
| 1244 callback(); | 1245 callback(); |
| 1245 }).catchError((e) { | 1246 }).catchError((e) { |
| 1247 // TODO(floitsch): should we try to report the stacktrace? |
| 1246 print("Process error:"); | 1248 print("Process error:"); |
| 1247 print(" Command: $_executable ${_batchArguments.join(' ')}"); | 1249 print(" Command: $_executable ${_batchArguments.join(' ')}"); |
| 1248 print(" Error: $e"); | 1250 print(" Error: $e"); |
| 1249 // If there is an error starting a batch process, chances are that | 1251 // If there is an error starting a batch process, chances are that |
| 1250 // it will always fail. So rather than re-trying a 1000+ times, we | 1252 // it will always fail. So rather than re-trying a 1000+ times, we |
| 1251 // exit. | 1253 // exit. |
| 1252 io.exit(1); | 1254 io.exit(1); |
| 1253 return true; | 1255 return true; |
| 1254 }); | 1256 }); |
| 1255 } | 1257 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 var regexp = new RegExp(r".*selenium-server-standalone.*"); | 1409 var regexp = new RegExp(r".*selenium-server-standalone.*"); |
| 1408 if (regexp.hasMatch(line)) { | 1410 if (regexp.hasMatch(line)) { |
| 1409 _seleniumAlreadyRunning = true; | 1411 _seleniumAlreadyRunning = true; |
| 1410 resumeTesting(); | 1412 resumeTesting(); |
| 1411 } | 1413 } |
| 1412 if (!_isSeleniumAvailable) { | 1414 if (!_isSeleniumAvailable) { |
| 1413 _startSeleniumServer(); | 1415 _startSeleniumServer(); |
| 1414 } | 1416 } |
| 1415 }); | 1417 }); |
| 1416 }).catchError((e) { | 1418 }).catchError((e) { |
| 1419 // TODO(floitsch): should we try to report the stacktrace? |
| 1417 print("Error starting process:"); | 1420 print("Error starting process:"); |
| 1418 print(" Command: $cmd ${arg.join(' ')}"); | 1421 print(" Command: $cmd ${arg.join(' ')}"); |
| 1419 print(" Error: $e"); | 1422 print(" Error: $e"); |
| 1420 // TODO(ahe): How to report this as a test failure? | 1423 // TODO(ahe): How to report this as a test failure? |
| 1421 io.exit(1); | 1424 io.exit(1); |
| 1422 return true; | 1425 return true; |
| 1423 }); | 1426 }); |
| 1424 } | 1427 } |
| 1425 } | 1428 } |
| 1426 | 1429 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 // server is ready). | 1475 // server is ready). |
| 1473 Stream<String> stdoutStringStream = | 1476 Stream<String> stdoutStringStream = |
| 1474 _seleniumServer.stdout.transform(new io.StringDecoder()) | 1477 _seleniumServer.stdout.transform(new io.StringDecoder()) |
| 1475 .transform(new io.LineTransformer()); | 1478 .transform(new io.LineTransformer()); |
| 1476 Stream<String> stderrStringStream = | 1479 Stream<String> stderrStringStream = |
| 1477 _seleniumServer.stderr.transform(new io.StringDecoder()) | 1480 _seleniumServer.stderr.transform(new io.StringDecoder()) |
| 1478 .transform(new io.LineTransformer()); | 1481 .transform(new io.LineTransformer()); |
| 1479 stdoutStringStream.listen(seleniumServerHandler); | 1482 stdoutStringStream.listen(seleniumServerHandler); |
| 1480 stderrStringStream.listen(seleniumServerHandler); | 1483 stderrStringStream.listen(seleniumServerHandler); |
| 1481 }).catchError((e) { | 1484 }).catchError((e) { |
| 1485 // TODO(floitsch): should we try to report the stacktrace? |
| 1482 print("Process error:"); | 1486 print("Process error:"); |
| 1483 print(" Command: java -jar $file"); | 1487 print(" Command: java -jar $file"); |
| 1484 print(" Error: $e"); | 1488 print(" Error: $e"); |
| 1485 // TODO(ahe): How to report this as a test failure? | 1489 // TODO(ahe): How to report this as a test failure? |
| 1486 io.exit(1); | 1490 io.exit(1); |
| 1487 return true; | 1491 return true; |
| 1488 }); | 1492 }); |
| 1489 } | 1493 } |
| 1490 } | 1494 } |
| 1491 }); | 1495 }); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 } | 1737 } |
| 1734 } | 1738 } |
| 1735 | 1739 |
| 1736 void eventAllTestsDone() { | 1740 void eventAllTestsDone() { |
| 1737 for (var listener in _eventListener) { | 1741 for (var listener in _eventListener) { |
| 1738 listener.allDone(); | 1742 listener.allDone(); |
| 1739 } | 1743 } |
| 1740 } | 1744 } |
| 1741 } | 1745 } |
| 1742 | 1746 |
| OLD | NEW |