Unittest hangs on completion

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 30 06:12:35 PST 2016


On 12/29/16 8:33 PM, David Zhang wrote:
> On Friday, 30 December 2016 at 01:25:50 UTC, Steven Schveighoffer wrote:
>> Looks like that comes from here:
>>
>> https://github.com/dlang/dub/blob/master/source/dub/dub.d#L577
>>
>> I have serious doubts that this is the correct way to run tests, as
>> share ctors are supposed to have run BEFORE unit tests are allowed to.
>> It's quite possible (and likely) that unit tests are running before
>> critical other shared ctors have completed, which is why something
>> isn't working.
>>
>> In any case, it looks like the unit tests have run, and run
>> successfully, and then main has run, and then it's the teardown of the
>> runtime that's hanging.
>>
>> I'm not 100% certain, because I don't know exactly how this code comes
>> into play -- it's a string in this file.
>
> Huh, shouldn't this problem have manifested itself earlier then? Why
> only now? I don't remember this happening previously.

This is one of those very fragile and seemingly random types of things. 
A change in code, a change in linker order, maybe even random chance, 
can cause it to fail or not.

> At the very least
> I'm pretty sure I first encountered it last week. Unless something in
> DMD was patched? But then there'd be no way I'm the only one
> encountering this problem, and there don't appear to be any issues on
> github's tracker.

It depends on what is actually hanging the process. If it's something in 
your code base only, then nobody else would be seeing it.

-Steve


More information about the Digitalmars-d-learn mailing list