From dc39124662b25ce2db28454f1749d67550e4de31 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 19 Feb 2004 00:55:28 +0000 Subject: Update. 2004-02-18 Carlos O'Donell * test-skeleton.c (main): If set, use environment variable TIMEOUTFACTOR to scale test TIMEOUT. --- test-skeleton.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'test-skeleton.c') diff --git a/test-skeleton.c b/test-skeleton.c index f9061ca186..9d9a68b62c 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 , 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)); -- cgit 1.4.1