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

login
register
mail settings
Submitter Pierre-Yves David
Date May 9, 2015, 9:25 p.m.
Message ID <48e50507613c24311537.1431206720@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8998/
State Accepted
Headers show

Comments

Pierre-Yves David - May 9, 2015, 9:25 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Gregory Szorc - May 10, 2015, 4:51 p.m.
On Sat, May 9, 2015 at 2:25 PM, Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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.
>
>
Series LGTM.

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()