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 14 matching lines...) Expand all Loading... |
25 import "path.dart"; | 25 import "path.dart"; |
26 import 'record_and_replay.dart'; | 26 import 'record_and_replay.dart'; |
27 import "runtime_configuration.dart"; | 27 import "runtime_configuration.dart"; |
28 import "status_file_parser.dart"; | 28 import "status_file_parser.dart"; |
29 import "test_progress.dart"; | 29 import "test_progress.dart"; |
30 import "test_suite.dart"; | 30 import "test_suite.dart"; |
31 import "utils.dart"; | 31 import "utils.dart"; |
32 | 32 |
33 const int CRASHING_BROWSER_EXITCODE = -10; | 33 const int CRASHING_BROWSER_EXITCODE = -10; |
34 const int SLOW_TIMEOUT_MULTIPLIER = 4; | 34 const int SLOW_TIMEOUT_MULTIPLIER = 4; |
| 35 const int NON_UTF_FAKE_EXITCODE = 0xFFFD; |
35 | 36 |
36 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; | 37 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; |
37 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; | 38 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; |
38 | 39 |
39 typedef void TestCaseEvent(TestCase testCase); | 40 typedef void TestCaseEvent(TestCase testCase); |
40 typedef void ExitCodeEvent(int exitCode); | 41 typedef void ExitCodeEvent(int exitCode); |
41 typedef void EnqueueMoreWork(ProcessQueue queue); | 42 typedef void EnqueueMoreWork(ProcessQueue queue); |
42 | 43 |
43 // Some IO tests use these variables and get confused if the host environment | 44 // Some IO tests use these variables and get confused if the host environment |
44 // variables are inherited so they are excluded. | 45 // variables are inherited so they are excluded. |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 List<int> this.stderr, | 978 List<int> this.stderr, |
978 Duration this.time, | 979 Duration this.time, |
979 bool this.compilationSkipped, | 980 bool this.compilationSkipped, |
980 int this.pid) { | 981 int this.pid) { |
981 diagnostics = []; | 982 diagnostics = []; |
982 } | 983 } |
983 | 984 |
984 Expectation result(TestCase testCase) { | 985 Expectation result(TestCase testCase) { |
985 if (hasCrashed) return Expectation.CRASH; | 986 if (hasCrashed) return Expectation.CRASH; |
986 if (hasTimedOut) return Expectation.TIMEOUT; | 987 if (hasTimedOut) return Expectation.TIMEOUT; |
987 return hasFailed(testCase) ? Expectation.FAIL : Expectation.PASS; | 988 if (hasFailed(testCase)) return Expectation.FAIL; |
| 989 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
| 990 return Expectation.PASS; |
988 } | 991 } |
989 | 992 |
990 bool get hasCrashed { | 993 bool get hasCrashed { |
991 // dart2js exits with code 253 in case of unhandled exceptions. | 994 // dart2js exits with code 253 in case of unhandled exceptions. |
992 // The dart binary exits with code 253 in case of an API error such | 995 // The dart binary exits with code 253 in case of an API error such |
993 // as an invalid snapshot file. | 996 // as an invalid snapshot file. |
994 // In either case an exit code of 253 is considered a crash. | 997 // In either case an exit code of 253 is considered a crash. |
995 if (exitCode == 253) return true; | 998 if (exitCode == 253) return true; |
996 if (io.Platform.operatingSystem == 'windows') { | 999 if (io.Platform.operatingSystem == 'windows') { |
997 // The VM uses std::abort to terminate on asserts. | 1000 // The VM uses std::abort to terminate on asserts. |
(...skipping 26 matching lines...) Expand all Loading... |
1024 bool get successful { | 1027 bool get successful { |
1025 // FIXME(kustermann): We may need to change this | 1028 // FIXME(kustermann): We may need to change this |
1026 return !hasTimedOut && exitCode == 0; | 1029 return !hasTimedOut && exitCode == 0; |
1027 } | 1030 } |
1028 | 1031 |
1029 // Reverse result of a negative test. | 1032 // Reverse result of a negative test. |
1030 bool hasFailed(TestCase testCase) { | 1033 bool hasFailed(TestCase testCase) { |
1031 return testCase.isNegative ? !didFail(testCase) : didFail(testCase); | 1034 return testCase.isNegative ? !didFail(testCase) : didFail(testCase); |
1032 } | 1035 } |
1033 | 1036 |
| 1037 bool get hasNonUtf8 => exitCode == NON_UTF_FAKE_EXITCODE; |
| 1038 |
1034 Expectation _negateOutcomeIfNegativeTest( | 1039 Expectation _negateOutcomeIfNegativeTest( |
1035 Expectation outcome, bool isNegative) { | 1040 Expectation outcome, bool isNegative) { |
1036 if (!isNegative) return outcome; | 1041 if (!isNegative) return outcome; |
1037 if (outcome == Expectation.IGNORE) return outcome; | 1042 if (outcome == Expectation.IGNORE) return outcome; |
1038 if (outcome.canBeOutcomeOf(Expectation.FAIL)) { | 1043 if (outcome.canBeOutcomeOf(Expectation.FAIL)) { |
1039 return Expectation.PASS; | 1044 return Expectation.PASS; |
1040 } | 1045 } |
1041 return Expectation.FAIL; | 1046 return Expectation.FAIL; |
1042 } | 1047 } |
1043 } | 1048 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 BrowserCommandOutputImpl( | 1084 BrowserCommandOutputImpl( |
1080 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped) | 1085 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped) |
1081 : super(command, exitCode, timedOut, stdout, stderr, time, | 1086 : super(command, exitCode, timedOut, stdout, stderr, time, |
1082 compilationSkipped, 0), | 1087 compilationSkipped, 0), |
1083 _infraFailure = _failedBecauseOfFlakyInfrastructure(stderr); | 1088 _infraFailure = _failedBecauseOfFlakyInfrastructure(stderr); |
1084 | 1089 |
1085 Expectation result(TestCase testCase) { | 1090 Expectation result(TestCase testCase) { |
1086 // Handle crashes and timeouts first | 1091 // Handle crashes and timeouts first |
1087 if (hasCrashed) return Expectation.CRASH; | 1092 if (hasCrashed) return Expectation.CRASH; |
1088 if (hasTimedOut) return Expectation.TIMEOUT; | 1093 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1094 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1089 | 1095 |
1090 if (_infraFailure) { | 1096 if (_infraFailure) { |
1091 return Expectation.IGNORE; | 1097 return Expectation.IGNORE; |
1092 } | 1098 } |
1093 var outcome = _getOutcome(); | 1099 var outcome = _getOutcome(); |
1094 | 1100 |
1095 if (testCase.hasRuntimeError) { | 1101 if (testCase.hasRuntimeError) { |
1096 if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) { | 1102 if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) { |
1097 return Expectation.MISSING_RUNTIME_ERROR; | 1103 return Expectation.MISSING_RUNTIME_ERROR; |
1098 } | 1104 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 List<int> stdout, | 1395 List<int> stdout, |
1390 List<int> stderr) | 1396 List<int> stderr) |
1391 : super(command, 0, result.didTimeout, stdout, stderr, result.duration, | 1397 : super(command, 0, result.didTimeout, stdout, stderr, result.duration, |
1392 false, 0) { | 1398 false, 0) { |
1393 _result = result; | 1399 _result = result; |
1394 } | 1400 } |
1395 | 1401 |
1396 Expectation result(TestCase testCase) { | 1402 Expectation result(TestCase testCase) { |
1397 // Handle timeouts first | 1403 // Handle timeouts first |
1398 if (_result.didTimeout) return Expectation.TIMEOUT; | 1404 if (_result.didTimeout) return Expectation.TIMEOUT; |
| 1405 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1399 | 1406 |
1400 // Multitests are handled specially | 1407 // Multitests are handled specially |
1401 if (testCase.hasRuntimeError) { | 1408 if (testCase.hasRuntimeError) { |
1402 if (_rawOutcome == Expectation.RUNTIME_ERROR) return Expectation.PASS; | 1409 if (_rawOutcome == Expectation.RUNTIME_ERROR) return Expectation.PASS; |
1403 return Expectation.MISSING_RUNTIME_ERROR; | 1410 return Expectation.MISSING_RUNTIME_ERROR; |
1404 } | 1411 } |
1405 | 1412 |
1406 return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative); | 1413 return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative); |
1407 } | 1414 } |
1408 } | 1415 } |
(...skipping 12 matching lines...) Expand all Loading... |
1421 compilationSkipped, 0); | 1428 compilationSkipped, 0); |
1422 | 1429 |
1423 Expectation result(TestCase testCase) { | 1430 Expectation result(TestCase testCase) { |
1424 // TODO(kustermann): If we run the analyzer not in batch mode, make sure | 1431 // TODO(kustermann): If we run the analyzer not in batch mode, make sure |
1425 // that command.exitCodes matches 2 (errors), 1 (warnings), 0 (no warnings, | 1432 // that command.exitCodes matches 2 (errors), 1 (warnings), 0 (no warnings, |
1426 // no errors) | 1433 // no errors) |
1427 | 1434 |
1428 // Handle crashes and timeouts first | 1435 // Handle crashes and timeouts first |
1429 if (hasCrashed) return Expectation.CRASH; | 1436 if (hasCrashed) return Expectation.CRASH; |
1430 if (hasTimedOut) return Expectation.TIMEOUT; | 1437 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1438 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1431 | 1439 |
1432 // Get the errors/warnings from the analyzer | 1440 // Get the errors/warnings from the analyzer |
1433 List<String> errors = []; | 1441 List<String> errors = []; |
1434 List<String> warnings = []; | 1442 List<String> warnings = []; |
1435 parseAnalyzerOutput(errors, warnings); | 1443 parseAnalyzerOutput(errors, warnings); |
1436 | 1444 |
1437 // Handle errors / missing errors | 1445 // Handle errors / missing errors |
1438 if (testCase.expectCompileError) { | 1446 if (testCase.expectCompileError) { |
1439 if (errors.length > 0) { | 1447 if (errors.length > 0) { |
1440 return Expectation.PASS; | 1448 return Expectation.PASS; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1518 |
1511 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, | 1519 VmCommandOutputImpl(Command command, int exitCode, bool timedOut, |
1512 List<int> stdout, List<int> stderr, Duration time, int pid) | 1520 List<int> stdout, List<int> stderr, Duration time, int pid) |
1513 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); | 1521 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); |
1514 | 1522 |
1515 Expectation result(TestCase testCase) { | 1523 Expectation result(TestCase testCase) { |
1516 // Handle crashes and timeouts first | 1524 // Handle crashes and timeouts first |
1517 if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.DARTK_CRASH; | 1525 if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.DARTK_CRASH; |
1518 if (hasCrashed) return Expectation.CRASH; | 1526 if (hasCrashed) return Expectation.CRASH; |
1519 if (hasTimedOut) return Expectation.TIMEOUT; | 1527 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1528 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1520 | 1529 |
1521 // Multitests are handled specially | 1530 // Multitests are handled specially |
1522 if (testCase.expectCompileError) { | 1531 if (testCase.expectCompileError) { |
1523 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { | 1532 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
1524 return Expectation.PASS; | 1533 return Expectation.PASS; |
1525 } | 1534 } |
1526 return Expectation.MISSING_COMPILETIME_ERROR; | 1535 return Expectation.MISSING_COMPILETIME_ERROR; |
1527 } | 1536 } |
1528 if (testCase.hasRuntimeError) { | 1537 if (testCase.hasRuntimeError) { |
1529 // TODO(kustermann): Do we consider a "runtimeError" only an uncaught | 1538 // TODO(kustermann): Do we consider a "runtimeError" only an uncaught |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 if (hasCrashed) return Expectation.CRASH; | 1579 if (hasCrashed) return Expectation.CRASH; |
1571 if (hasTimedOut) { | 1580 if (hasTimedOut) { |
1572 bool isWindows = io.Platform.operatingSystem == 'windows'; | 1581 bool isWindows = io.Platform.operatingSystem == 'windows'; |
1573 bool isBrowserTestCase = | 1582 bool isBrowserTestCase = |
1574 testCase.commands.any((command) => command is BrowserTestCommand); | 1583 testCase.commands.any((command) => command is BrowserTestCommand); |
1575 // TODO(26060) Dart2js batch mode hangs on Windows under heavy load. | 1584 // TODO(26060) Dart2js batch mode hangs on Windows under heavy load. |
1576 return (isWindows && isBrowserTestCase) | 1585 return (isWindows && isBrowserTestCase) |
1577 ? Expectation.IGNORE | 1586 ? Expectation.IGNORE |
1578 : Expectation.TIMEOUT; | 1587 : Expectation.TIMEOUT; |
1579 } | 1588 } |
| 1589 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1580 | 1590 |
1581 // Handle dart2js specific crash detection | 1591 // Handle dart2js specific crash detection |
1582 if (exitCode == DART2JS_EXITCODE_CRASH || | 1592 if (exitCode == DART2JS_EXITCODE_CRASH || |
1583 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || | 1593 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || |
1584 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { | 1594 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { |
1585 return Expectation.CRASH; | 1595 return Expectation.CRASH; |
1586 } | 1596 } |
1587 | 1597 |
1588 // Multitests are handled specially | 1598 // Multitests are handled specially |
1589 if (testCase.expectCompileError) { | 1599 if (testCase.expectCompileError) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 class JsCommandlineOutputImpl extends CommandOutputImpl | 1657 class JsCommandlineOutputImpl extends CommandOutputImpl |
1648 with UnittestSuiteMessagesMixin { | 1658 with UnittestSuiteMessagesMixin { |
1649 JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut, | 1659 JsCommandlineOutputImpl(Command command, int exitCode, bool timedOut, |
1650 List<int> stdout, List<int> stderr, Duration time) | 1660 List<int> stdout, List<int> stderr, Duration time) |
1651 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0); | 1661 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0); |
1652 | 1662 |
1653 Expectation result(TestCase testCase) { | 1663 Expectation result(TestCase testCase) { |
1654 // Handle crashes and timeouts first | 1664 // Handle crashes and timeouts first |
1655 if (hasCrashed) return Expectation.CRASH; | 1665 if (hasCrashed) return Expectation.CRASH; |
1656 if (hasTimedOut) return Expectation.TIMEOUT; | 1666 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1667 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1657 | 1668 |
1658 if (testCase.hasRuntimeError) { | 1669 if (testCase.hasRuntimeError) { |
1659 if (exitCode != 0) return Expectation.PASS; | 1670 if (exitCode != 0) return Expectation.PASS; |
1660 return Expectation.MISSING_RUNTIME_ERROR; | 1671 return Expectation.MISSING_RUNTIME_ERROR; |
1661 } | 1672 } |
1662 | 1673 |
1663 var outcome = exitCode == 0 ? Expectation.PASS : Expectation.RUNTIME_ERROR; | 1674 var outcome = exitCode == 0 ? Expectation.PASS : Expectation.RUNTIME_ERROR; |
1664 outcome = _negateOutcomeIfIncompleteAsyncTest(outcome, decodeUtf8(stdout)); | 1675 outcome = _negateOutcomeIfIncompleteAsyncTest(outcome, decodeUtf8(stdout)); |
1665 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); | 1676 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
1666 } | 1677 } |
1667 } | 1678 } |
1668 | 1679 |
1669 class PubCommandOutputImpl extends CommandOutputImpl { | 1680 class PubCommandOutputImpl extends CommandOutputImpl { |
1670 PubCommandOutputImpl(PubCommand command, int exitCode, bool timedOut, | 1681 PubCommandOutputImpl(PubCommand command, int exitCode, bool timedOut, |
1671 List<int> stdout, List<int> stderr, Duration time) | 1682 List<int> stdout, List<int> stderr, Duration time) |
1672 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0); | 1683 : super(command, exitCode, timedOut, stdout, stderr, time, false, 0); |
1673 | 1684 |
1674 Expectation result(TestCase testCase) { | 1685 Expectation result(TestCase testCase) { |
1675 // Handle crashes and timeouts first | 1686 // Handle crashes and timeouts first |
1676 if (hasCrashed) return Expectation.CRASH; | 1687 if (hasCrashed) return Expectation.CRASH; |
1677 if (hasTimedOut) return Expectation.TIMEOUT; | 1688 if (hasTimedOut) return Expectation.TIMEOUT; |
| 1689 if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
1678 | 1690 |
1679 if (exitCode == 0) { | 1691 if (exitCode == 0) { |
1680 return Expectation.PASS; | 1692 return Expectation.PASS; |
1681 } else if ((command as PubCommand).command == 'get') { | 1693 } else if ((command as PubCommand).command == 'get') { |
1682 return Expectation.PUB_GET_ERROR; | 1694 return Expectation.PUB_GET_ERROR; |
1683 } else { | 1695 } else { |
1684 return Expectation.FAIL; | 1696 return Expectation.FAIL; |
1685 } | 1697 } |
1686 } | 1698 } |
1687 } | 1699 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 * it is longer than MAX_HEAD characters, and just keeps the head and | 1761 * it is longer than MAX_HEAD characters, and just keeps the head and |
1750 * the last TAIL_LENGTH characters of the output. | 1762 * the last TAIL_LENGTH characters of the output. |
1751 */ | 1763 */ |
1752 class OutputLog { | 1764 class OutputLog { |
1753 static const int MAX_HEAD = 100 * 1024; | 1765 static const int MAX_HEAD = 100 * 1024; |
1754 static const int TAIL_LENGTH = 10 * 1024; | 1766 static const int TAIL_LENGTH = 10 * 1024; |
1755 List<int> head = <int>[]; | 1767 List<int> head = <int>[]; |
1756 List<int> tail; | 1768 List<int> tail; |
1757 List<int> complete; | 1769 List<int> complete; |
1758 bool dataDropped = false; | 1770 bool dataDropped = false; |
| 1771 bool hasNonUtf8 = false; |
1759 | 1772 |
1760 OutputLog(); | 1773 OutputLog(); |
1761 | 1774 |
1762 void add(List<int> data) { | 1775 void add(List<int> data) { |
1763 if (complete != null) { | 1776 if (complete != null) { |
1764 throw new StateError("Cannot add to OutputLog after calling toList"); | 1777 throw new StateError("Cannot add to OutputLog after calling toList"); |
1765 } | 1778 } |
1766 if (tail == null) { | 1779 if (tail == null) { |
1767 head.addAll(data); | 1780 head.addAll(data); |
1768 if (head.length > MAX_HEAD) { | 1781 if (head.length > MAX_HEAD) { |
1769 tail = head.sublist(MAX_HEAD); | 1782 tail = head.sublist(MAX_HEAD); |
1770 head.length = MAX_HEAD; | 1783 head.length = MAX_HEAD; |
1771 } | 1784 } |
1772 } else { | 1785 } else { |
1773 tail.addAll(data); | 1786 tail.addAll(data); |
1774 } | 1787 } |
1775 if (tail != null && tail.length > 2 * TAIL_LENGTH) { | 1788 if (tail != null && tail.length > 2 * TAIL_LENGTH) { |
1776 tail = _truncatedTail(); | 1789 tail = _truncatedTail(); |
1777 dataDropped = true; | 1790 dataDropped = true; |
1778 } | 1791 } |
1779 } | 1792 } |
1780 | 1793 |
1781 List<int> _truncatedTail() => tail.length > TAIL_LENGTH | 1794 List<int> _truncatedTail() => tail.length > TAIL_LENGTH |
1782 ? tail.sublist(tail.length - TAIL_LENGTH) | 1795 ? tail.sublist(tail.length - TAIL_LENGTH) |
1783 : tail; | 1796 : tail; |
1784 | 1797 |
| 1798 |
| 1799 void _checkUtf8(List<int> data) { |
| 1800 try { |
| 1801 UTF8.decode(data, allowMalformed: false); |
| 1802 } on FormatException catch (e) { |
| 1803 hasNonUtf8 = true; |
| 1804 String malformed = UTF8.decode(data, allowMalformed: true); |
| 1805 data..clear() |
| 1806 ..addAll(malformed.codeUnits) |
| 1807 ..addAll(""" |
| 1808 |
| 1809 ***************************************************************************** |
| 1810 |
| 1811 test.dart: The output of this test contained non-UTF8 formatted data. |
| 1812 |
| 1813 ***************************************************************************** |
| 1814 |
| 1815 """ |
| 1816 .codeUnits); |
| 1817 } |
| 1818 } |
| 1819 |
| 1820 |
1785 List<int> toList() { | 1821 List<int> toList() { |
1786 if (complete == null) { | 1822 if (complete == null) { |
1787 complete = head; | 1823 complete = head; |
1788 if (dataDropped) { | 1824 if (dataDropped) { |
1789 complete.addAll(""" | 1825 complete.addAll(""" |
1790 | 1826 |
1791 ***************************************************************************** | 1827 ***************************************************************************** |
1792 | 1828 |
1793 Data removed due to excessive length | 1829 test.dart: Data was removed due to excessive length |
1794 | 1830 |
1795 ***************************************************************************** | 1831 ***************************************************************************** |
1796 | 1832 |
1797 """ | 1833 """ |
1798 .codeUnits); | 1834 .codeUnits); |
1799 complete.addAll(_truncatedTail()); | 1835 complete.addAll(_truncatedTail()); |
1800 } else if (tail != null) { | 1836 } else if (tail != null) { |
1801 complete.addAll(tail); | 1837 complete.addAll(tail); |
1802 } | 1838 } |
1803 head = null; | 1839 head = null; |
1804 tail = null; | 1840 tail = null; |
| 1841 _checkUtf8(complete); |
1805 } | 1842 } |
1806 return complete; | 1843 return complete; |
1807 } | 1844 } |
1808 } | 1845 } |
1809 | 1846 |
1810 // Helper to get a list of all child pids for a parent process. | 1847 // Helper to get a list of all child pids for a parent process. |
1811 // The first element of the list is the parent pid. | 1848 // The first element of the list is the parent pid. |
1812 Future<List<int>> _getPidList(pid, diagnostics) async { | 1849 Future<List<int>> _getPidList(pid, diagnostics) async { |
1813 var pid_list = [pid]; | 1850 var pid_list = [pid]; |
1814 var lines; | 1851 var lines; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 | 2066 |
2030 void _commandComplete(int exitCode) { | 2067 void _commandComplete(int exitCode) { |
2031 if (timeoutTimer != null) { | 2068 if (timeoutTimer != null) { |
2032 timeoutTimer.cancel(); | 2069 timeoutTimer.cancel(); |
2033 } | 2070 } |
2034 var commandOutput = _createCommandOutput(command, exitCode); | 2071 var commandOutput = _createCommandOutput(command, exitCode); |
2035 completer.complete(commandOutput); | 2072 completer.complete(commandOutput); |
2036 } | 2073 } |
2037 | 2074 |
2038 CommandOutput _createCommandOutput(ProcessCommand command, int exitCode) { | 2075 CommandOutput _createCommandOutput(ProcessCommand command, int exitCode) { |
| 2076 List<int> stdoutData = stdout.toList(); |
| 2077 List<int> stderrData = stderr.toList(); |
| 2078 if (stdout.hasNonUtf8 || stderr.hasNonUtf8) { |
| 2079 // If the output contained non-utf8 formatted data, then make the exit |
| 2080 // code non-zero if it isn't already. |
| 2081 if (exitCode == 0) { |
| 2082 exitCode = NON_UTF_FAKE_EXITCODE; |
| 2083 } |
| 2084 } |
2039 var commandOutput = createCommandOutput( | 2085 var commandOutput = createCommandOutput( |
2040 command, | 2086 command, |
2041 exitCode, | 2087 exitCode, |
2042 timedOut, | 2088 timedOut, |
2043 stdout.toList(), | 2089 stdoutData, |
2044 stderr.toList(), | 2090 stderrData, |
2045 new DateTime.now().difference(startTime), | 2091 new DateTime.now().difference(startTime), |
2046 compilationSkipped, | 2092 compilationSkipped, |
2047 pid); | 2093 pid); |
2048 commandOutput.diagnostics.addAll(diagnostics); | 2094 commandOutput.diagnostics.addAll(diagnostics); |
2049 return commandOutput; | 2095 return commandOutput; |
2050 } | 2096 } |
2051 | 2097 |
2052 StreamSubscription _drainStream( | 2098 StreamSubscription _drainStream( |
2053 Stream<List<int>> source, OutputLog destination) { | 2099 Stream<List<int>> source, OutputLog destination) { |
2054 return source.listen(destination.add); | 2100 return source.listen(destination.add); |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3312 } | 3358 } |
3313 } | 3359 } |
3314 | 3360 |
3315 void eventAllTestsDone() { | 3361 void eventAllTestsDone() { |
3316 for (var listener in _eventListener) { | 3362 for (var listener in _eventListener) { |
3317 listener.allDone(); | 3363 listener.allDone(); |
3318 } | 3364 } |
3319 _allDone(); | 3365 _allDone(); |
3320 } | 3366 } |
3321 } | 3367 } |
OLD | NEW |