public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR
@ 2021-12-04 20:45 H.J. Lu
  2021-12-04 20:55 ` Florian Weimer
  2021-12-05 18:22 ` Aurelien Jarno
  0 siblings, 2 replies; 3+ messages in thread
From: H.J. Lu @ 2021-12-04 20:45 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer

On Ice Lake and Tiger Lake laptops, some test programs timeout when there
are 3 "make check -j8" runs in parallel.  Add --with-timeoutfactor=NUM to
specify an integer to scale the timeout of test programs, which can be
overriden by TIMEOUTFACTOR environment variable.
---
 INSTALL                     |  5 +++++
 config.h.in                 |  3 +++
 configure                   | 16 ++++++++++++++++
 configure.ac                |  7 +++++++
 manual/install.texi         |  5 +++++
 support/support_test_main.c |  2 +-
 6 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/INSTALL b/INSTALL
index 02dcf6b1ca..899d7f1ed7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,11 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      particular case and potentially change debugging information and
      metadata only).
 
+'--with-timeoutfactor=NUM'
+     Specify an integer NUM to scale the timeout of test programs.  This
+     factor can be changed at run time using 'TIMEOUTFACTOR' environment
+     variable.
+
 '--disable-shared'
      Don't build shared libraries even if it is possible.  Not all
      systems support shared libraries; you need ELF support and
diff --git a/config.h.in b/config.h.in
index 0a6f57b006..2f5124684e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -196,6 +196,9 @@
 /* Define to 1 if libpthread actually resides in libc.  */
 #define PTHREAD_IN_LIBC 0
 
+/* An integer used to scale the timeout of test programs.  */
+#define TIMEOUTFACTOR 1
+
 /*
 \f */
 
diff --git a/configure b/configure
index 2f9adca064..e4d013907c 100755
--- a/configure
+++ b/configure
@@ -764,6 +764,7 @@ with_selinux
 with_headers
 with_default_link
 with_nonshared_cflags
+with_timeoutfactor
 enable_sanity_checks
 enable_shared
 enable_profile
@@ -1482,6 +1483,8 @@ Optional Packages:
   --with-default-link     do not use explicit linker scripts
   --with-nonshared-cflags=CFLAGS
                           build nonshared libraries with additional CFLAGS
+  --with-timeoutfactor=NUM
+                          specify an integer to scale the timeout
   --with-cpu=CPU          select code for CPU variant
 
 Some influential environment variables:
@@ -3386,6 +3389,19 @@ fi
 
 
 
+
+# Check whether --with-timeoutfactor was given.
+if test "${with_timeoutfactor+set}" = set; then :
+  withval=$with_timeoutfactor; timeoutfactor=$withval
+else
+  timeoutfactor=1
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define TIMEOUTFACTOR $timeoutfactor
+_ACEOF
+
+
 # Check whether --enable-sanity-checks was given.
 if test "${enable_sanity_checks+set}" = set; then :
   enableval=$enable_sanity_checks; enable_sanity=$enableval
diff --git a/configure.ac b/configure.ac
index 7eb4239359..a91a7f399c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,13 @@ AC_ARG_WITH([nonshared-cflags],
 	    [extra_nonshared_cflags=])
 AC_SUBST(extra_nonshared_cflags)
 
+AC_ARG_WITH([timeoutfactor],
+	    AS_HELP_STRING([--with-timeoutfactor=NUM],
+			   [specify an integer to scale the timeout]),
+	    [timeoutfactor=$withval],
+	    [timeoutfactor=1])
+AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
+
 AC_ARG_ENABLE([sanity-checks],
 	      AS_HELP_STRING([--disable-sanity-checks],
 			     [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
diff --git a/manual/install.texi b/manual/install.texi
index 46f73b538d..fce5155c22 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -131,6 +131,11 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag
 (although this will not affect the generated code in this particular
 case and potentially change debugging information and metadata only).
 
+@item --with-timeoutfactor=@var{NUM}
+Specify an integer @var{NUM} to scale the timeout of test programs.
+This factor can be changed at run time using @env{TIMEOUTFACTOR}
+environment variable.
+
 @c disable static doesn't work currently
 @c @item --disable-static
 @c Don't build static libraries.  Static libraries aren't that useful these
diff --git a/support/support_test_main.c b/support/support_test_main.c
index 66a754b84f..0e07dc53cd 100644
--- a/support/support_test_main.c
+++ b/support/support_test_main.c
@@ -286,7 +286,7 @@ support_test_main (int argc, char **argv, const struct test_config *config)
   int direct = 0;       /* Directly call the test function?  */
   int status;
   int opt;
-  unsigned int timeoutfactor = 1;
+  unsigned int timeoutfactor = TIMEOUTFACTOR;
   pid_t termpid;
 
   /* If we're debugging the test, we need to disable timeouts and use
-- 
2.33.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR
  2021-12-04 20:45 [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR H.J. Lu
@ 2021-12-04 20:55 ` Florian Weimer
  2021-12-05 18:22 ` Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2021-12-04 20:55 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha

* H. J. Lu:

> On Ice Lake and Tiger Lake laptops, some test programs timeout when there
> are 3 "make check -j8" runs in parallel.  Add --with-timeoutfactor=NUM to
> specify an integer to scale the timeout of test programs, which can be
> overriden by TIMEOUTFACTOR environment variable.

Looks good, thanks.

Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR
  2021-12-04 20:45 [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR H.J. Lu
  2021-12-04 20:55 ` Florian Weimer
@ 2021-12-05 18:22 ` Aurelien Jarno
  1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2021-12-05 18:22 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha, Florian Weimer

On 2021-12-04 12:45, H.J. Lu via Libc-alpha wrote:
> On Ice Lake and Tiger Lake laptops, some test programs timeout when there
> are 3 "make check -j8" runs in parallel.  Add --with-timeoutfactor=NUM to
> specify an integer to scale the timeout of test programs, which can be
> overriden by TIMEOUTFACTOR environment variable.
> ---
>  INSTALL                     |  5 +++++
>  config.h.in                 |  3 +++
>  configure                   | 16 ++++++++++++++++
>  configure.ac                |  7 +++++++
>  manual/install.texi         |  5 +++++
>  support/support_test_main.c |  2 +-
>  6 files changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/INSTALL b/INSTALL
> index 02dcf6b1ca..899d7f1ed7 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -106,6 +106,11 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
>       particular case and potentially change debugging information and
>       metadata only).
>  
> +'--with-timeoutfactor=NUM'
> +     Specify an integer NUM to scale the timeout of test programs.  This
> +     factor can be changed at run time using 'TIMEOUTFACTOR' environment
> +     variable.
> +

You might want to specify that this is only valid for the C test
programs. For other programs, only the environment variable is
supported.

Alternatively you might want to export this to the environment variables
so that all tests use this timeout factor.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-05 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 20:45 [PATCH v2] Add --with-timeoutfactor=NUM to specify TIMEOUTFACTOR H.J. Lu
2021-12-04 20:55 ` Florian Weimer
2021-12-05 18:22 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).