summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2013-03-11 15:40:32 -0600
committerEric Blake <eblake@redhat.com>2013-03-11 15:40:32 -0600
commita8d9f4635238f845bb76269a54fbb2c55255d365 (patch)
tree4fa4812ca43cfc9d9eaed017e7d480298d080cba /tests
parent6169015de81eaa4f8148d29abcd640b4f4ab1b56 (diff)
downloadgnulib-a8d9f4635238f845bb76269a54fbb2c55255d365.tar.gz
tests: make it easier to bypass alarm time in debugger
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-file-has-acl.c7
-rw-r--r--tests/test-memmem.c3
-rw-r--r--tests/test-passfd.c3
-rw-r--r--tests/test-ptsname.c3
-rw-r--r--tests/test-ptsname_r.c3
-rw-r--r--tests/test-strcasestr.c3
-rw-r--r--tests/test-strstr.c3
7 files changed, 17 insertions, 8 deletions
diff --git a/tests/test-file-has-acl.c b/tests/test-file-has-acl.c
index a9bfd50cd8..56cc3baf0b 100644
--- a/tests/test-file-has-acl.c
+++ b/tests/test-file-has-acl.c
@@ -49,8 +49,11 @@ main (int argc, char *argv[])
#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);
+ }
#endif
#if USE_ACL
diff --git a/tests/test-memmem.c b/tests/test-memmem.c
index 6b3325b487..97ae7c1634 100644
--- a/tests/test-memmem.c
+++ b/tests/test-memmem.c
@@ -43,8 +43,9 @@ main (int argc, char *argv[])
caused by SIGALRM. All known platforms that lack alarm also lack
memmem, and the replacement memmem is known to not take too
long. */
+ int alarm_value = 100;
signal (SIGALRM, SIG_DFL);
- alarm (100);
+ alarm (alarm_value);
#endif
{
diff --git a/tests/test-passfd.c b/tests/test-passfd.c
index c11a82859f..6389e154ee 100644
--- a/tests/test-passfd.c
+++ b/tests/test-passfd.c
@@ -45,8 +45,9 @@ main ()
# if HAVE_DECL_ALARM
/* Avoid hanging on failure. */
+ int alarm_value = 5;
signal (SIGALRM, SIG_DFL);
- alarm (5);
+ alarm (alarm_value);
# endif
fdnull = open ("/dev/null", O_RDWR);
diff --git a/tests/test-ptsname.c b/tests/test-ptsname.c
index 29cf72cfb4..15d4925bae 100644
--- a/tests/test-ptsname.c
+++ b/tests/test-ptsname.c
@@ -59,8 +59,9 @@ main (void)
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
+ int alarm_value = 5;
signal (SIGALRM, SIG_DFL);
- alarm (5);
+ alarm (alarm_value);
#endif
{
diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c
index acc3c94cc8..b194303815 100644
--- a/tests/test-ptsname_r.c
+++ b/tests/test-ptsname_r.c
@@ -104,8 +104,9 @@ main (void)
#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
caused by SIGALRM. */
+ int alarm_value = 5;
signal (SIGALRM, SIG_DFL);
- alarm (5);
+ alarm (alarm_value);
#endif
{
diff --git a/tests/test-strcasestr.c b/tests/test-strcasestr.c
index 0ca36921f1..df75e789be 100644
--- a/tests/test-strcasestr.c
+++ b/tests/test-strcasestr.c
@@ -37,8 +37,9 @@ main ()
caused by SIGALRM. All known platforms that lack alarm also lack
strcasestr, and the replacement strcasestr is known to not take too
long. */
+ int alarm_value = 50;
signal (SIGALRM, SIG_DFL);
- alarm (50);
+ alarm (alarm_value);
#endif
{
diff --git a/tests/test-strstr.c b/tests/test-strstr.c
index 2d2cea1a98..80e809317f 100644
--- a/tests/test-strstr.c
+++ b/tests/test-strstr.c
@@ -37,8 +37,9 @@ main (int argc, char *argv[])
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. */
+ int alarm_value = 50;
signal (SIGALRM, SIG_DFL);
- alarm (50);
+ alarm (alarm_value);
#endif
{