From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>
Subject: Re: Module suggestion: timeout
Date: Thu, 29 Apr 2021 16:19:23 +0200 [thread overview]
Message-ID: <1734109.oLkUVmKVoB@omega> (raw)
In-Reply-To: <CAEYrNrToxH2y85z2Qmu1bbws6F4f4d-Vuv_CrBE0ZX6LPpoLTg@mail.gmail.com>
Hi Marc,
Marc Nieper-Wißkirchen wrote:
> Gnulib contains a module named valgrind
More precisely, it's called 'valgrind-tests'. See
https://www.gnu.org/software/gnulib/manual/html_node/Using-valgrind-automatically.html
> 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).
The situations are a bit different:
1) For the timeout, there is a coding idiom that needs little code and works
also when the 'timeout' program is not present:
#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
2) For the timeout, different tests need different timeouts. Whereas valgrind
typically does not need per-program arguments.
3) If a way to enable a timeout exists, it is typically never useful to run a
unit test without a timeout. Whereas if valgrind is available, it is still
useful to run a unit test without valgrind:
- the unit test runs much faster without valgrind,
- the unit test might not be prepared to cope with the extra '==...' lines
output to stderr.
So, I don't think the "let's treat timeout like valgrind" approach is going
to work. Instead, you need to design a way to deal with timeouts, independently.
Bruno
next prev parent reply other threads:[~2021-04-29 14:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 12:22 Module suggestion Marc Nieper-Wißkirchen
2021-04-29 14:19 ` Bruno Haible [this message]
2021-04-30 9:24 ` Module suggestion: timeout Simon Josefsson via Gnulib discussion list
2021-04-30 9:37 ` Marc Nieper-Wißkirchen
2021-04-30 9:43 ` Simon Josefsson via Gnulib discussion list
2021-04-30 9:47 ` Marc Nieper-Wißkirchen
2021-05-01 21:13 ` bug#48113: " Karl Berry
2021-05-02 7:30 ` Simon Josefsson via Gnulib discussion list
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1734109.oLkUVmKVoB@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=marc.nieper+gnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).