Gnulib contains a module named valgrind that allows the easy use of Valgrind for tests whenever it is supported by the build system.
I would suggest to add a similar module named timeout that sets the variable TIMEOUT with suitable defaults whenever the GNU coreutils timeout program (or an equivalent) is available. This would allow test runners to be unconditionally prefixed with $(TIMEOUT) so that on supporting systems, tests are killed (and an error is reported) whenever they run for too long (mostly because of a logic error causing an infinite loop). Thanks, Marc