# HG changeset patch # User Pierre-Yves David # Date 1567930121 -7200 # Node ID fc8072f38fd660171f49979311709363986d6463 # Parent d7304434390f5efca405744fa12a6585edae3d83 run-tests: extract a `process_cmd_line` from the main function The main function doing line comparison is quite complex. Slicing it in smaller piece should clarify it. (This is a gratuitous cleanup that I made while investigating a bug). diff -r d7304434390f -r fc8072f38fd6 tests/run-tests.py --- a/tests/run-tests.py Sun Sep 08 09:42:53 2019 +0200 +++ b/tests/run-tests.py Sun Sep 08 10:08:41 2019 +0200 @@ -1695,15 +1695,7 @@ continue postout.append(b' ' + el) - if cmd_line: - # Add on last return code. - ret = int(cmd_line.split()[1]) - if ret != 0: - postout.append(b' [%d]\n' % ret) - if pos in after: - # Merge in non-active test bits. - postout += after.pop(pos) - pos = int(cmd_line.split()[0]) + pos, postout = self._process_cmd_line(cmd_line, pos, postout, after) if pos in after: postout += after.pop(pos) @@ -1713,6 +1705,19 @@ return exitcode, postout + def _process_cmd_line(self, cmd_line, pos, postout, after): + """process a "command" part of a line from unified test output""" + if cmd_line: + # Add on last return code. + ret = int(cmd_line.split()[1]) + if ret != 0: + postout.append(b' [%d]\n' % ret) + if pos in after: + # Merge in non-active test bits. + postout += after.pop(pos) + pos = int(cmd_line.split()[0]) + return pos, postout + @staticmethod def rematch(el, l): try: