Raising the bar on Phobos unittest coverage

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 18 16:06:34 PDT 2013


On Monday, March 18, 2013 23:44:15 Martin Nowak wrote:
> On 03/18/2013 09:30 PM, Jonathan M Davis wrote:
> >>> Can someone look into std.file's unittests. They use 60% (32s/50s) of
> >>> 
> >>> > >>the unittest RUNtime on my machine.
> >> > >
> >> > >My first guess would be that you're running a different OS from Walter
> >> > >and
> >> > >that OS-specific code counts as not being run when you run it on a
> >> > >different OS.
> >>
> >>Code that is statically compiled out is not counted as executable code by
> >>the coverage analyzer.
> 
> Sorry for the misunderstanding, but I really meant runtime as in time.
> It's great that we're striving for more unittest coverage but we should
> keep an eye on the time it takes to run them.
> So I ran the executables with /bin/time and std.file accounts for 60% of
> the total runtime (not including compilation). Even though file IO is
> notoriously slow this seems excessive.
> 
> https://github.com/D-Programming-Language/phobos/pull/653

Yeah. The typical approach of testing each function individually is a bit 
expensive with std.file. It really should be refactored so that it does 
everything in only a few unittest blocks rather than a bunch of them so that 
it minimizes how much it repeats I/O operations. I've been meaning to go 
through it and do that but haven't gotten around to it yet. Thanks for 
reminding me though. I'd forgotten about it.

Still, 60% of the total runtime seems awfully high. I don't recall every 
getting the impression that anything like that was going on.

- Jonathan M Davis


More information about the Digitalmars-d mailing list