[PATCH] test-skeleton.c using TIMEOUTFACTOR.
Carlos O'Donell
carlos@baldric.uwo.ca
Wed Feb 18 23:00:00 GMT 2004
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));
More information about the Libc-alpha
mailing list