Patchwork [1,of,2] cmdserver: include non-zero return code of runcommand in test output

login
register
mail settings
Submitter Yuya Nishihara
Date March 3, 2014, 6:59 a.m.
Message ID <2051c10042dd53ea3a30.1393829991@gimlet>
Download mbox | patch
Permalink /patch/3831/
State Accepted
Commit 0b04ee8e789df77f7fdfac6635e0f5d652196283
Headers show

Comments

Yuya Nishihara - March 3, 2014, 6:59 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1393829448 -32400
#      Mon Mar 03 15:50:48 2014 +0900
# Node ID 2051c10042dd53ea3a3071e59eb0a33baba0b822
# Parent  3c72fa74eb2d3f9e52e70705e2ece2c838c91045
cmdserver: include non-zero return code of runcommand in test output

Patch

diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -51,7 +51,10 @@  def runcommand(server, args, output=sys.
         elif ch == 'L':
             writeblock(server, input.readline(data))
         elif ch == 'r':
-            return struct.unpack('>i', data)[0]
+            ret, = struct.unpack('>i', data)
+            if ret != 0:
+                print ' [%d]' % ret
+            return ret
         else:
             print "unexpected channel %c: %r" % (ch, data)
             if ch.isupper():
diff --git a/tests/test-commandserver.py.out b/tests/test-commandserver.py.out
--- a/tests/test-commandserver.py.out
+++ b/tests/test-commandserver.py.out
@@ -142,6 +142,7 @@  testing rollback:
 
  runcommand phase -r . -p
 no phases changed
+ [1]
  runcommand commit -Am.
  runcommand rollback
 repository tip rolled back to revision 3 (undo commit)