aboutsummaryrefslogtreecommitdiff
path: root/test-skeleton.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-19 00:55:28 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-19 00:55:28 +0000
commitdc39124662b25ce2db28454f1749d67550e4de31 (patch)
tree299ee292b80429f09d31b07fa7c9b8dba2ef45ff /test-skeleton.c
parent4a08113c4ee0ec9f83ef2ae8a4c5893e80d451f7 (diff)
downloadglibc-dc39124662b25ce2db28454f1749d67550e4de31.zip
glibc-dc39124662b25ce2db28454f1749d67550e4de31.tar.gz
glibc-dc39124662b25ce2db28454f1749d67550e4de31.tar.bz2
Update.
2004-02-18 Carlos O'Donell <carlos@baldric.uwo.ca> * test-skeleton.c (main): If set, use environment variable TIMEOUTFACTOR to scale test TIMEOUT.
Diffstat (limited to 'test-skeleton.c')
-rw-r--r--test-skeleton.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/test-skeleton.c b/test-skeleton.c
index f9061ca..9d9a68b 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -1,5 +1,5 @@
/* Skeleton for test programs.
- Copyright (C) 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -193,6 +193,7 @@ main (int argc, char *argv[])
int direct = 0; /* Directly call the test function? */
int status;
int opt;
+ unsigned int timeoutfactor = 1;
pid_t termpid;
#ifdef STDOUT_UNBUFFERED
@@ -215,6 +216,19 @@ main (int argc, char *argv[])
#endif
}
+ /* If set, read the test TIMEOUTFACTOR value from the environment.
+ This value is used to scale the default test timeout values. */
+ char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR");
+ if (envstr_timeoutfactor != NULL)
+ {
+ char *envstr_conv = envstr_timeoutfactor;
+ unsigned long int env_fact;
+
+ env_fact = strtoul (envstr_timeoutfactor, &envstr_conv, 0);
+ if (*envstr_conv == '\0' && envstr_conv != envstr_timeoutfactor)
+ timeoutfactor = MAX (env_fact, 1);
+ }
+
/* Set TMPDIR to specified test directory. */
if (test_dir != NULL)
{
@@ -306,7 +320,7 @@ main (int argc, char *argv[])
# define TIMEOUT 2
#endif
signal (SIGALRM, timeout_handler);
- alarm (TIMEOUT);
+ alarm (TIMEOUT * timeoutfactor);
/* Wait for the regular termination. */
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));