# HG changeset patch # User Mads Kiilerich # Date 1289176540 -3600 # Node ID 7060aa668b7f408cd95ab020b434abf16bf85ac9 # Parent e1a5259b3d03e1fb60a133d56036f6e30f90db0d tests: (no-eol) markup for command output without trailing LF Output chunks without a trailing LF will now work but get (no-eol) appended. This change mostly moves code around so we can handle that an output line starts with data from previous command, followed by salt and the next command. [ original upstream message ] diff -r e1a5259b3d03 -r 7060aa668b7f tests/run-tests.py --- a/tests/run-tests.py Sat Nov 06 00:31:44 2010 +0100 +++ b/tests/run-tests.py Mon Nov 08 01:35:40 2010 +0100 @@ -531,29 +531,37 @@ postout = [] ret = 0 for n, l in enumerate(output): - if l.startswith(salt): + lout, lcmd = l, None + if salt in l: + lout, lcmd = l.split(salt, 1) + + if lout: + if lcmd: + lout += ' (no-eol)\n' + + el = None + if pos in expected and expected[pos]: + el = expected[pos].pop(0) + + if el == lout: # perfect match (fast) + postout.append(" " + lout) + elif el and el.decode('string-escape') == l: + postout.append(" " + el) # \-escape match + elif (el and + (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or + el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout))): + postout.append(" " + el) # fallback regex/glob match + else: + postout.append(" " + lout) # let diff deal with it + + if lcmd: # add on last return code - ret = int(l.split()[2]) + ret = int(lcmd.split()[1]) if ret != 0: postout.append(" [%s]\n" % ret) if pos in after: postout += after.pop(pos) - pos = int(l.split()[1]) - else: - el = None - if pos in expected and expected[pos]: - el = expected[pos].pop(0) - - if el == l: # perfect match (fast) - postout.append(" " + l) - elif el and el.decode('string-escape') == l: - postout.append(" " + el) # \-escape match - elif (el and - (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or - el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l))): - postout.append(" " + el) # fallback regex/glob match - else: - postout.append(" " + l) # let diff deal with it + pos = int(lcmd.split()[0]) if pos in after: postout += after.pop(pos)