This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Test timeouts
- From: Jeff Bailey <jbailey at raspberryginger dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 26 Jul 2006 07:37:30 -0400
- Subject: Test timeouts
Hi! I hit a timeout earlier while doing a test build, and had to go
source diving to find out what the duration of the timeout. This patch
provides the information in the failure output.
2006-07-26 Jeff Bailey <jbailey@ubuntu.com>
* test-skeleton.c (TIMEOUT): Move to the top.
(timeout_handler): Display seconds after which test timed out.
Index: test-skeleton.c
===================================================================
RCS file: /cvs/glibc/libc/test-skeleton.c,v
retrieving revision 1.30
diff -u -p -r1.30 test-skeleton.c
--- test-skeleton.c 23 Dec 2005 01:03:28 -0000 1.30
+++ test-skeleton.c 26 Jul 2006 11:31:04 -0000
@@ -43,6 +43,12 @@
# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */
#endif
+/* Set timeout. */
+#ifndef TIMEOUT
+/* Default timeout is two seconds. */
+# define TIMEOUT 2
+#endif
+
#define OPT_DIRECT 1000
#define OPT_TESTDIR 1001
@@ -174,7 +180,7 @@ timeout_handler (int sig __attribute__ (
#endif
if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
- fputs ("Timed out: killed the child process\n", stderr);
+ fprintf (stderr, "Timed out: killed the child process after %d seconds\n", TIMEOUT);
else if (WIFSTOPPED (status))
fprintf (stderr, "Timed out: the child process was %s\n",
strsignal (WSTOPSIG (status)));
@@ -320,11 +326,6 @@ main (int argc, char *argv[])
exit (1);
}
- /* Set timeout. */
-#ifndef TIMEOUT
- /* Default timeout is two seconds. */
-# define TIMEOUT 2
-#endif
signal (SIGALRM, timeout_handler);
alarm (TIMEOUT * timeoutfactor);