Show exit codes in unified tests?
Matt Mackall
mpm at selenic.com
Wed Sep 15 15:14:58 CDT 2010
I've been tinkering with this (see example output in the last hunk):
diff -r fb10e46c1679 tests/run-tests.py
--- a/tests/run-tests.py Wed Sep 15 20:41:14 2010 +0200
+++ b/tests/run-tests.py Wed Sep 15 15:10:51 2010 -0500
@@ -474,7 +474,7 @@
after.setdefault(pos, []).append(l)
prepos = pos
pos = n
- script.append('echo %s %s\n' % (salt, n))
+ script.append('echo %s %s $?\n' % (salt, n))
script.append(l[4:])
elif l.startswith(' > '): # continuations
after.setdefault(prepos, []).append(l)
@@ -486,6 +486,8 @@
# non-command/result - queue up for merged output
after.setdefault(pos, []).append(l)
+ script.append('echo %s %s $?\n' % (salt, n + 1))
+
fd, name = tempfile.mkstemp(suffix='hg-tst')
try:
@@ -508,8 +510,13 @@
pos = -1
postout = []
+ ret = 0
for n, l in enumerate(output):
if l.startswith(salt):
+ # add on last return code
+ ret = int(l.split()[2])
+ if ret != 0:
+ postout.append(" [%s]\n" % ret)
if pos in after:
postout += after.pop(pos)
pos = int(l.split()[1])
diff -r fb10e46c1679 tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t Wed Sep 15 20:41:14 2010 +0200
+++ b/tests/test-bookmarks-pushpull.t Wed Sep 15 15:10:51 2010 -0500
@@ -60,6 +60,8 @@
$ hg push -B badname ../a
bookmark badname does not exist on the local or remote repository!
+ [2]
$ hg pull -B anotherbadname ../a
abort: remote bookmark anotherbadname not found!
+ [255]
$ true
This only show nonzero exit codes. Turning this on currently breaks 107
tests. And there are probably issues with different exit codes from
non-hg tools on different platforms we'd need to sort out too.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list