This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Add TIMEOUT environment variable support to all tests, usable via <test>-ENV= in Makefile.


On Wed, Jan 07, 2004 at 02:00:09PM -0800, Ulrich Drepper wrote:
> We are not going to add all this kind of crap.  If your machine is so
> obsolete but you still use it, this must not impact others.
> 
> It was proposed to add support for an environment variable which
> test-skeleton.c will look for.  The value of the variable can be used as
> a multiple for all timeouts.  But nobody who is masochistic enough to
> use such junk has written the code.

I never know what to expect when you respond to my postings. No insult
intended, you are merely a surprise :)

What do you think of the following, along with the hppa example Makefile
modification? Builds, and allows hppa to pass the test. Not tested for
any other arch, though I assume it should work.

Please feel free to change the name of the environment variable.

2004-01-08  Carlos O'Donell  <carlos@baldric.uwo.ca>

	* test-skeleton.c (main): Use TIMEOUT environmnet variable for
	the test timeout, with priority above the macro definition.
	* sysdeps/hppa/Makefile (tst-tls13-ENV): Add TIMEOUT=10,
	extending the test timeout so it passes on slow machines.

Index: test-skeleton.c
===================================================================
RCS file: /cvs/glibc/libc/test-skeleton.c,v
retrieving revision 1.27
diff -u -p -r1.27 test-skeleton.c
--- test-skeleton.c	31 Dec 2003 19:24:24 -0000	1.27
+++ test-skeleton.c	8 Jan 2004 07:52:46 -0000
@@ -193,6 +193,8 @@ main (int argc, char *argv[])
   int direct = 0;	/* Directly call the test function?  */
   int status;
   int opt;
+  int env_timeout = -1;	
+  char * envstr_timeout;
   pid_t termpid;
 
 #ifdef STDOUT_UNBUFFERED
@@ -215,6 +217,21 @@ main (int argc, char *argv[])
 #endif
       }
 
+  /* If set, read the test TIMEOUT value from the environment */
+  envstr_timeout = getenv("TIMEOUT");
+  if (envstr_timeout != NULL)
+    {
+      if (*envstr_timeout != '\0')
+        {
+          char ** envstr_conv = &envstr_timeout;
+          long env_long;
+
+          env_long = strtol(envstr_timeout, envstr_conv, 10);
+          if (**envstr_conv == '\0')
+	    env_timeout = env_long;
+	}
+    }
+  
   /* Set TMPDIR to specified test directory.  */
   if (test_dir != NULL)
     {
@@ -306,7 +323,11 @@ main (int argc, char *argv[])
 # define TIMEOUT 2
 #endif
   signal (SIGALRM, timeout_handler);
-  alarm (TIMEOUT);
+  if (env_timeout != -1)
+    /* Use the TIMEOUT environment variable over the macro */
+    alarm(env_timeout);
+  else
+    alarm (TIMEOUT);
 
   /* Wait for the regular termination.  */
   termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
Index: sysdeps/hppa/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/hppa/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sysdeps/hppa/Makefile	18 Dec 2003 03:51:49 -0000	1.8
+++ sysdeps/hppa/Makefile	8 Jan 2004 07:52:46 -0000
@@ -27,6 +27,9 @@ CFLAGS-rtld.c += -mdisable-fpregs
 sysdep-dl-routines += dl-symaddr dl-fptr
 sysdep_routines += $(sysdep-dl-routines)
 sysdep-rtld-routines += $(sysdep-dl-routines)
+
+# dlopen/dlclose takes too long, modify test timeout.
+tst-tls13-ENV = TIMEOUT=10
 endif
 
 ifeq ($(subdir),csu)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]