[Piglit] [PATCH 2/2] Run all tests out of a ThreadPool

Kenneth Graunke kenneth at whitecape.org
Mon Oct 7 07:07:30 CEST 2013


On 09/16/2013 09:09 AM, Dylan Baker wrote:
> This patch removes the ConcurrentThreadPool singleton and opts instead
> for creating two ThreadPools, one with multiple threads and a second one
> that contains only one thread.
> 
> The reasoning for this change is two fold, first it gets rid of a rather
> questionable use of a singleton, and second it cleans up the Test
> derived classes. since they don't have to have a method to add
> themselves to the ThreadPool, instead the ThreadPool has a method for
> adding tests to itself.
> 
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  framework/core.py    | 36 ++++++++++++++++--------------------
>  framework/threads.py | 17 -----------------
>  2 files changed, 16 insertions(+), 37 deletions(-)
> 
> diff --git a/framework/core.py b/framework/core.py
> index bebe1b8..1c9537b 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -36,9 +36,12 @@ import traceback
>  from log import log
>  from cStringIO import StringIO
>  from textwrap import dedent
> -from threads import ConcurrentTestPool
>  from threads import synchronized_self
>  import threading
> +import multiprocessing
> +
> +from threadpool import ThreadPool
> +
>  
>  __all__ = ['Environment',
>             'checkDir',
> @@ -421,19 +424,9 @@ class Test:
>      def run(self):
>          raise NotImplementedError
>  
> -    def schedule(self, env, path, json_writer):
> -        '''
> -        Schedule test to be run via the concurrent thread pool.
> -        This is a no-op if the test isn't marked as concurrent.
> -
> -        See ``Test.doRun`` for a description of the parameters.
> -        '''
> -        if self.runConcurrent:
> -            ConcurrentTestPool().put(self.doRun, args=(env, path, json_writer))
> -
> -    def doRun(self, env, path, json_writer):
> +    def execute(self, env, path, json_writer):
>          '''
> -        Run the test immediately.
> +        Run a the test.

Typo here..."a the".

>  
>          :path:
>              Fully qualified test name as a string.  For example,
> @@ -558,18 +551,21 @@ class TestProfile:
>  
>          self.prepare_test_list(env)
>  
> -        # Queue up all the concurrent tests, so the pool is filled
> -        # at the start of the test run.
> +        # If using concurrency, add all the cocurrent tests to the pool and

Typo: "cocurrent tests"

Sadly, these patches don't fix the bad file descriptor on Python 2.7.5.
 You still need to use 2.7.3 to have a working Piglit.  Looking more and
more like a Python bug.

With the typos fixed, this is:
Reviewed-and-tested-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the Piglit mailing list