std.experimental.testing formal review

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 29 07:34:41 PDT 2015


On Tuesday, 29 September 2015 at 10:45:23 UTC, Per Nordlöw wrote:
> On Wednesday, 9 September 2015 at 15:20:41 UTC, Robert burner 
> Schadek wrote:
>> This post marks the start of the two week review process of 
>> std.experimental.testing.
>
> Will `runTests` automatically assert that all pure unittests by 
> default are parallellized and all non-pure are serialized? If 
> so why is the @serial UDA needed?

runTests with no optional arguments will run the tests in threads.
There's nothing about purity enforcement there. In fact, I tried
using pure unit tests yesterday with std.experimental.testing
and couldn't. The compiler inferred the functions to not be pure.
I tried adding pure to them and descended into a madness of adding
pure all over phobos until I got fed up. It seems to be something
to do with `format` not being pure, I have no idea why. It really
should be.

@serial is needed to _not_ run tests in threads, which you'd need
if those tests call functions that mutate global state. Even
"thread-global" is bad here since those tests could run in the 
same
or different threads depending on the run.

> Will it make use of D's builtin threadpool or will every 
> unittest run in its own thread? IMHO, we should strive for 
> threadpool usage here.

It uses the thread pool.

Atila





More information about the Digitalmars-d mailing list