]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
tests: make it easier to bypass alarm time in debugger
authorEric Blake <eblake@redhat.com>
Mon, 11 Mar 2013 21:40:32 +0000 (15:40 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 11 Mar 2013 21:40:32 +0000 (15:40 -0600)
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>
ChangeLog
tests/test-file-has-acl.c
tests/test-memmem.c
tests/test-passfd.c
tests/test-ptsname.c
tests/test-ptsname_r.c
tests/test-strcasestr.c
tests/test-strstr.c

index addadee9553156863be72cfbd808857b661983c1..a608362187dcf743eacc69f730a4dc4d1c5c3e46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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.
index a9bfd50cd8a9de55e3f7a3947c71b7bea469f473..56cc3baf0b42590ba6d6a2daf1261dee2d504058 100644 (file)
@@ -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
index 6b3325b4879b2358407eab65c1dcafe251722f15..97ae7c163454f021d974f9565fda2eee0dd8e43f 100644 (file)
@@ -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
 
   {
index c11a82859fdb0d1b159c1cbe8bc87c58c1e4a450..6389e154ee8c0dee743b091e6bf27251f94b38de 100644 (file)
@@ -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);
index 29cf72cfb4601c75203b2c51c98e0bddf7aeefc0..15d4925bae9192fb4f9812926ca717f59d7a9c96 100644 (file)
@@ -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
 
   {
index acc3c94cc8cff220a790fcc159d8df991fea09c7..b194303815bef311ac561601bfdbb5fa688a828e 100644 (file)
@@ -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
 
   {
index 0ca36921f100bc299b99a0a8725e89ae144cf5a1..df75e789bebbea55b117a879d469da6b7654a464 100644 (file)
@@ -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
 
   {
index 2d2cea1a98fecd804b8b6d2897112e2afbeeefc5..80e809317f77fd1da22b27fdf85106da72cd05da 100644 (file)
@@ -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
 
   {