This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] test-skeleton.c using TIMEOUTFACTOR.
- From: Carlos O'Donell <carlos at baldric dot uwo dot ca>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Wed, 18 Feb 2004 18:00:15 -0500
- Subject: [PATCH] test-skeleton.c using TIMEOUTFACTOR.
libc-alpha,
Cleaning up my local tree...
Allow developers running tests to scale the default test-skeleton
TIMEOUT value with an enviroment variable TIMEOUTFACTOR.
Passes testing on i386, hppa systems.
Cheers,
Carlos.
--
test-skeleton.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletion(-)
2004-02-18 Carlos O'Donell <carlos@baldric.uwo.ca>
* test-skeleton.c (main): If set, use environment variable
TIMEOUTFACTOR to scale test TIMEOUT.
--- libc-orig/test-skeleton.c 2004-01-01 15:54:28.000000000 -0500
+++ libc/test-skeleton.c 2004-01-31 17:11:22.000000000 -0500
@@ -193,6 +193,8 @@
int direct = 0; /* Directly call the test function? */
int status;
int opt;
+ int timeoutfactor = 1;
+ char * envstr_timeoutfactor;
pid_t termpid;
#ifdef STDOUT_UNBUFFERED
@@ -215,6 +217,22 @@
#endif
}
+ /* If set, read the test TIMEOUTFACTOR value from the environment.
+ This value is used to scale the default test timeout values. */
+ envstr_timeoutfactor = getenv("TIMEOUTFACTOR");
+ if (envstr_timeoutfactor != NULL)
+ {
+ if (*envstr_timeoutfactor != '\0')
+ {
+ char ** envstr_conv = &envstr_timeoutfactor;
+ long env_long;
+
+ env_long = strtol(envstr_timeoutfactor, envstr_conv, 10);
+ if (**envstr_conv == '\0')
+ timeoutfactor = env_long;
+ }
+ }
+
/* Set TMPDIR to specified test directory. */
if (test_dir != NULL)
{
@@ -306,7 +324,7 @@
# 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));