Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 85541
Status: open
Priority: 0/
Queue: Test-Harness

People
Owner: Nobody in particular
Requestors: EARONESTY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: when test hangs, prove hangs
"prove" should be able to set an alarm before running tests, and kill tests on failure. (It would even be better if the first few lines of a test contained an ETA, in addition to the number of tests). Without this feature, it's possible for a single hung test to cause an entire harness to hang, never finish, and never report anything.
On 2013-05-22 09:25:45, EARONESTY wrote: Show quoted text
> "prove" should be able to set an alarm before running tests, and kill > tests on failure. (It would even be better if the first few lines of > a test contained an ETA, in addition to the number of tests). > > Without this feature, it's possible for a single hung test to cause an > entire harness to hang, never finish, and never report anything.
I created a proof-of-concept for a --timeout=$SECONDS parameter: https://github.com/eserte/Test-Harness/tree/timeout This is just a proof-of-concept; nothing mergeable here. Some notes about this: * --timeout works for both single and parallel mode * The timeout parameter is used in IO::Select's can_read() calls. This means that only a silent hanging test will cause the timeout mechanism to fire. A test which constantly generates output in an endless loop will still hang the whole harness. To fix this, maybe it would be sufficient to record the start time of every test script, check the runtime periodically (e.g. after can_read() returning), and emit a fail if the runtime exceeds the timeout. * Currently a timeout will cause a kill() of the child, which is mostly done for laziness. Better error handling is needed here. * I hope there's an easier way to pass the timeout parameter to the underlying modules. t/prove.t and t/proverun.t fail because of the extra parameter. * Tests and documentation are missing. There's a new test script t/sample-tests/hanging which could be used here, but the corresponding .t is missing. Regards, Slaven