While auditing alarm usage, I noticed that test-regex had a nice
idiom that made it easier to disable an alarm under glibc. Use
it elsewhere, so future copy-and-paste will preserve the idiom.
* tests/test-file-has-acl.c (main): Allow gdb to override alarm.
* tests/test-memmem.c (main): Likewise.
* tests/test-passfd.c (main): Likewise.
* tests/test-ptsname.c (main): Likewise.
* tests/test-ptsname_r.c (main): Likewise.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-strstr.c (main): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-03-11 Eric Blake <eblake@redhat.com>
2013-03-11 Eric Blake <eblake@redhat.com>
+ tests: make it easier to bypass alarm time in debugger
+ * tests/test-file-has-acl.c (main): Allow gdb to override alarm.
+ * tests/test-memmem.c (main): Likewise.
+ * tests/test-passfd.c (main): Likewise.
+ * tests/test-ptsname.c (main): Likewise.
+ * tests/test-ptsname_r.c (main): Likewise.
+ * tests/test-strcasestr.c (main): Likewise.
+ * tests/test-strstr.c (main): Likewise.
+
regex: port to mingw's recent addition of undeclared alarm
* doc/posix-functions/alarm.texi (alarm): Document that alarm
exists but still doesn't work in newer mingw.
regex: port to mingw's recent addition of undeclared alarm
* doc/posix-functions/alarm.texi (alarm): Document that alarm
exists but still doesn't work in newer mingw.
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
- signal (SIGALRM, SIG_DFL);
- alarm (5);
+ {
+ int alarm_value = 5;
+ signal (SIGALRM, SIG_DFL);
+ alarm (alarm_value);
+ }
caused by SIGALRM. All known platforms that lack alarm also lack
memmem, and the replacement memmem is known to not take too
long. */
caused by SIGALRM. All known platforms that lack alarm also lack
memmem, and the replacement memmem is known to not take too
long. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);
# if HAVE_DECL_ALARM
/* Avoid hanging on failure. */
# if HAVE_DECL_ALARM
/* Avoid hanging on failure. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);
# endif
fdnull = open ("/dev/null", O_RDWR);
# endif
fdnull = open ("/dev/null", O_RDWR);
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);
caused by SIGALRM. All known platforms that lack alarm also lack
strcasestr, and the replacement strcasestr is known to not take too
long. */
caused by SIGALRM. All known platforms that lack alarm also lack
strcasestr, and the replacement strcasestr is known to not take too
long. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);
caused by SIGALRM. All known platforms that lack alarm also have
a quadratic strstr, and the replacement strstr is known to not
take too long. */
caused by SIGALRM. All known platforms that lack alarm also have
a quadratic strstr, and the replacement strstr is known to not
take too long. */
signal (SIGALRM, SIG_DFL);
signal (SIGALRM, SIG_DFL);