Parallel execution of unittests

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 09:02:54 PDT 2014


On 4/30/14, 8:54 AM, Johannes Pfau wrote:
> Am Wed, 30 Apr 2014 08:43:31 -0700
> schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
>
>> However, this is too
>> coarse-grained - it would be great if each unittest could be pooled
>> across the thread pool. That's more difficult to implement.
>
> I filed a pull request which allowed running unit tests individually
> (and in different threads*) two years ago, but didn't pursue this
> further:
>
> https://github.com/D-Programming-Language/dmd/pull/1131
> https://github.com/D-Programming-Language/druntime/pull/308
>
> To summarize: It provides a function pointer for every  unit test to
> druntime or user code. This is actually easy to do. Naming tests
> requires changes in the parser, but I guess that shouldn't be difficult
> either.

That's fantastic, would you be willing to reconsider that work?

> * Some time ago there was a discussion whether unit tests can rely on
>    other tests being executed first / execution order. AFAIK some phobos
>    tests require this. That of course won't work if you run the tests in
>    different threads.

I think indeed a small number of unittests rely on order of execution. 
Those will be still runnable with a fork factor of 1. We'd need a way to 
specify that - either a flag or:

static shared this() { Runtime.unittestThreads = 1; }


Andrei




More information about the Digitalmars-d mailing list