How could I time out hanging tests in a Perl test harness?
I tried using the Test::Timer
module, but I can't seem to make it link up nicely with the TAP::Harness
in order to have an embedded timeout function for each test. Plus, I don't want to test if a bit of code takes x
time to complete, I just want to run my tests and timeout in case they hung for any reason.
There was a similar question on PerlMonks recently.
Install Time::Limit.
This module will allow you to set time limits for individual test files:
Or set an overall time limit for running the entire test suite:
If you're using
forkprove
instead ofprove
, then you need the time limiter to kill the entire process group: