[PATCH 1 of 2] run-tests: allow different extra weight for slow tests

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat May 9 16:25:20 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1431068647 25200
#      Fri May 08 00:04:07 2015 -0700
# Node ID 48e50507613c2431153722786b539b5d6e488dad
# Parent  17ba4ccd20b48511b3d06ab47fb1b2faf31410d7
run-tests: allow different extra weight for slow tests

The 'test-check-code-hg.t' file is not big enough to be prioritized properly.
As a result my tests run often spend about 15 seconds running only it at the
end of its tests run. We make the "slow" mechanism a bit smarter to adjust the
extra weight of each category independently in a future patch.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1621,22 +1621,25 @@ class TestRunner(object):
     def _run(self, tests):
         if self.options.random:
             random.shuffle(tests)
         else:
             # keywords for slow tests
-            slow = 'svn gendoc check-code-hg'.split()
+            slow = {'svn': 10,
+                    'gendoc': 10,
+                    'check-code-hg': 10,
+                   }
             def sortkey(f):
                 # run largest tests first, as they tend to take the longest
                 try:
                     val = -os.stat(f).st_size
                 except OSError, e:
                     if e.errno != errno.ENOENT:
                         raise
                     return -1e9 # file does not exist, tell early
-                for kw in slow:
+                for kw, mul in slow.iteritems():
                     if kw in f:
-                        val *= 10
+                        val *= mul
                 return val
             tests.sort(key=sortkey)
 
         self._testdir = os.environ['TESTDIR'] = os.getcwd()
 


More information about the Mercurial-devel mailing list