Show More
@@ -1633,85 +1633,84 b' class TTest(Test):' | |||||
1633 | return exitcode, postout |
|
1633 | return exitcode, postout | |
1634 |
|
1634 | |||
1635 | def _process_out_line(self, out_line, pos, postout, expected, warnonly): |
|
1635 | def _process_out_line(self, out_line, pos, postout, expected, warnonly): | |
1636 |
|
|
1636 | while out_line: | |
1637 |
|
|
1637 | if not out_line.endswith(b'\n'): | |
1638 |
|
|
1638 | out_line += b' (no-eol)\n' | |
1639 | out_line += b' (no-eol)\n' |
|
1639 | ||
1640 |
|
1640 | # Find the expected output at the current position. | ||
1641 | # Find the expected output at the current position. |
|
1641 | els = [None] | |
1642 | els = [None] |
|
1642 | if expected.get(pos, None): | |
1643 |
|
|
1643 | els = expected[pos] | |
1644 | els = expected[pos] |
|
1644 | ||
1645 |
|
1645 | optional = [] | ||
1646 | optional = [] |
|
1646 | for i, el in enumerate(els): | |
1647 |
|
|
1647 | r = False | |
1648 |
|
|
1648 | if el: | |
1649 | if el: |
|
1649 | r, exact = self.linematch(el, out_line) | |
1650 | r, exact = self.linematch(el, out_line) |
|
1650 | if isinstance(r, str): | |
1651 |
if |
|
1651 | if r == '-glob': | |
1652 |
|
|
1652 | out_line = ''.join(el.rsplit(' (glob)', 1)) | |
1653 | out_line = ''.join(el.rsplit(' (glob)', 1)) |
|
1653 | r = '' # Warn only this line. | |
1654 | r = '' # Warn only this line. |
|
1654 | elif r == "retry": | |
1655 | elif r == "retry": |
|
1655 | postout.append(b' ' + el) | |
1656 | postout.append(b' ' + el) |
|
1656 | else: | |
1657 | else: |
|
1657 | log('\ninfo, unknown linematch result: %r\n' % r) | |
1658 | log('\ninfo, unknown linematch result: %r\n' % r) |
|
1658 | r = False | |
1659 |
|
|
1659 | if r: | |
1660 |
|
|
1660 | els.pop(i) | |
|
1661 | break | |||
|
1662 | if el: | |||
|
1663 | if el.endswith(b" (?)\n"): | |||
|
1664 | optional.append(i) | |||
|
1665 | else: | |||
|
1666 | m = optline.match(el) | |||
|
1667 | if m: | |||
|
1668 | conditions = [ | |||
|
1669 | c for c in m.group(2).split(b' ')] | |||
|
1670 | ||||
|
1671 | if not self._iftest(conditions): | |||
|
1672 | optional.append(i) | |||
|
1673 | if exact: | |||
|
1674 | # Don't allow line to be matches against a later | |||
|
1675 | # line in the output | |||
1661 | els.pop(i) |
|
1676 | els.pop(i) | |
1662 | break |
|
1677 | break | |
1663 | if el: |
|
1678 | ||
1664 | if el.endswith(b" (?)\n"): |
|
1679 | if r: | |
1665 | optional.append(i) |
|
1680 | if r == "retry": | |
|
1681 | continue | |||
|
1682 | # clean up any optional leftovers | |||
|
1683 | for i in optional: | |||
|
1684 | postout.append(b' ' + els[i]) | |||
|
1685 | for i in reversed(optional): | |||
|
1686 | del els[i] | |||
|
1687 | postout.append(b' ' + el) | |||
|
1688 | else: | |||
|
1689 | if self.NEEDESCAPE(out_line): | |||
|
1690 | out_line = TTest._stringescape(b'%s (esc)\n' % | |||
|
1691 | out_line.rstrip(b'\n')) | |||
|
1692 | postout.append(b' ' + out_line) # Let diff deal with it. | |||
|
1693 | if r != '': # If line failed. | |||
|
1694 | warnonly = WARN_NO | |||
|
1695 | elif warnonly == WARN_UNDEFINED: | |||
|
1696 | warnonly = WARN_YES | |||
|
1697 | break | |||
|
1698 | else: | |||
|
1699 | # clean up any optional leftovers | |||
|
1700 | while expected.get(pos, None): | |||
|
1701 | el = expected[pos].pop(0) | |||
|
1702 | if el: | |||
|
1703 | if not el.endswith(b" (?)\n"): | |||
|
1704 | m = optline.match(el) | |||
|
1705 | if m: | |||
|
1706 | conditions = [c for c in m.group(2).split(b' ')] | |||
|
1707 | ||||
|
1708 | if self._iftest(conditions): | |||
|
1709 | # Don't append as optional line | |||
|
1710 | continue | |||
1666 | else: |
|
1711 | else: | |
1667 |
|
|
1712 | continue | |
1668 | if m: |
|
1713 | postout.append(b' ' + el) | |
1669 | conditions = [ |
|
|||
1670 | c for c in m.group(2).split(b' ')] |
|
|||
1671 |
|
||||
1672 | if not self._iftest(conditions): |
|
|||
1673 | optional.append(i) |
|
|||
1674 | if exact: |
|
|||
1675 | # Don't allow line to be matches against a later |
|
|||
1676 | # line in the output |
|
|||
1677 | els.pop(i) |
|
|||
1678 | break |
|
|||
1679 |
|
||||
1680 | if r: |
|
|||
1681 | if r == "retry": |
|
|||
1682 | continue |
|
|||
1683 | # clean up any optional leftovers |
|
|||
1684 | for i in optional: |
|
|||
1685 | postout.append(b' ' + els[i]) |
|
|||
1686 | for i in reversed(optional): |
|
|||
1687 | del els[i] |
|
|||
1688 | postout.append(b' ' + el) |
|
|||
1689 | else: |
|
|||
1690 | if self.NEEDESCAPE(out_line): |
|
|||
1691 | out_line = TTest._stringescape(b'%s (esc)\n' % |
|
|||
1692 | out_line.rstrip(b'\n')) |
|
|||
1693 | postout.append(b' ' + out_line) # Let diff deal with it. |
|
|||
1694 | if r != '': # If line failed. |
|
|||
1695 | warnonly = WARN_NO |
|
|||
1696 | elif warnonly == WARN_UNDEFINED: |
|
|||
1697 | warnonly = WARN_YES |
|
|||
1698 | break |
|
|||
1699 | else: |
|
|||
1700 | # clean up any optional leftovers |
|
|||
1701 | while expected.get(pos, None): |
|
|||
1702 | el = expected[pos].pop(0) |
|
|||
1703 | if el: |
|
|||
1704 | if not el.endswith(b" (?)\n"): |
|
|||
1705 | m = optline.match(el) |
|
|||
1706 | if m: |
|
|||
1707 | conditions = [c for c in m.group(2).split(b' ')] |
|
|||
1708 |
|
||||
1709 | if self._iftest(conditions): |
|
|||
1710 | # Don't append as optional line |
|
|||
1711 | continue |
|
|||
1712 | else: |
|
|||
1713 | continue |
|
|||
1714 | postout.append(b' ' + el) |
|
|||
1715 | return pos, postout, warnonly |
|
1714 | return pos, postout, warnonly | |
1716 |
|
1715 | |||
1717 | def _process_cmd_line(self, cmd_line, pos, postout, after): |
|
1716 | def _process_cmd_line(self, cmd_line, pos, postout, after): |
General Comments 0
You need to be logged in to leave comments.
Login now