Dear Bruno, dear Simon,
thank you for your replies.
I understand that valgrind-tests and the proposed "timeout-tests" solution are not completely equivalent. Nevertheless, I still think that some timeout functionality provided by Gnulib would be useful.
Bruno's solution
**
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
int alarm_value = 600;
signal (SIGALRM, SIG_DFL);
alarm (alarm_value);
#endif
**
works for unit tests that have been written specifically for the project. It doesn't help, though, if I want to test (production) binaries that are to be installed because I generally don't want testing code inside them.
Moreover, use cases for a baked-in timeout are not restricted to tests. For example, I may want to restrict the build time of certain components in situations where a logical error may lead to infinite build times (a simple example is that of a Scheme compiler used as a build tool; thanks to Turing-completeness of Scheme macros, such a build may not terminate).
Marc