On Fri, 20 Jun 2014 14:30:50 -0400, Sean Kelly <[email protected]>
wrote:
On Friday, 20 June 2014 at 18:24:21 UTC, Steven Schveighoffer
wrote:
No, I mean that druntime would run all unit tests with an expectation
that each unit test should time out after N seconds.
I'd be more inclined to have the test runner kill the process if
it takes more than N seconds to complete and call that a test
failure. Figuring out something reasonable to do in the unit
tester within Druntime would be difficult.
Timing individual tests is more likely to be accurate than timing the
whole set of unit tests. A slow machine could easily double or triple the
time the whole thing takes, and it would be difficult to pinpoint a
reasonable time that all machines would accept. But a single unit test
block should be really quick, I think 1 second is long enough to say it's
failed in the vast majority of cases. Of course, if they all take near 1
second, the total time will be huge. But we are not testing speed, we are
testing for infinite loops/hangs. The trick is specifying any info to the
runtime about specific unit tests, we don't have any mechanism to do that.
UDAs would be perfect.
I don't think it would be that difficult. you just need a separate thread
(can be written in D but only use C runtime), that exits the process if it
doesn't get pinged properly. Then the test runner has to ping the thread
between each test.
-Steve