Patchwork [032,of,179,tests-refactor] run-tests: move remaining result processing to Test.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:37 p.m.
Message ID <81791dd44f6a46347241.1399055869@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4527/
State Accepted
Commit 206814c9072af82dee460f0ebb8e691c2f1d7cc9
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397966025 25200
#      Sat Apr 19 20:53:45 2014 -0700
# Branch stable
# Node ID 81791dd44f6a46347241632be793ae3aa59da98d
# Parent  2d0503771b51eb8516f7b629ec7e12b092359e5b
run-tests: move remaining result processing to Test.run()

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -655,16 +655,20 @@  class Test(object):
             if info.get('servefail'):
                 msg += 'serve failed and '
             if ret:
                 msg += 'output changed and ' + describe(ret)
             else:
                 msg += 'output changed'
 
             return self.fail(msg, ret)
+        elif ret:
+            return self.fail(describe(ret), ret)
+        else:
+            return self.success()
 
     def _run(self, testtmp, replacements, env):
         raise NotImplemented('Subclasses must implement Test.run()')
 
     def _getreplacements(self, testtmp):
         port = self._options.port + self._count * 3
         r = [
             (r':%s\b' % port, ':$HGPORT'),
@@ -1156,23 +1160,16 @@  def runone(options, test, count):
 
     if (ret != 0 or out != refout) and not skipped and not options.debug:
         # Save errors to a file for diagnosis
         f = open(err, "wb")
         for line in out:
             f.write(line)
         f.close()
 
-    if result:
-        pass
-    elif ret:
-        result = t.fail(describe(ret), ret)
-    else:
-        result = t.success()
-
     if not options.verbose:
         iolock.acquire()
         sys.stdout.write(result[0])
         sys.stdout.flush()
         iolock.release()
 
     del t # For cleanup side-effects.