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