automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {testsuite-work} tests: prefer ulimit over timeout in test on a me


From: Stefano Lattarini
Subject: [FYI] {testsuite-work} tests: prefer ulimit over timeout in test on a memory-hogging bug
Date: Wed, 1 Jun 2011 16:38:30 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

* tests/cond29.test: Use 'ulimit' instead of 'timeout' to ensure
that automake does not uses up too much resources.  This is really
and improvement because the bug tested by this script wasn't just
a "it hangs" or "it runs too slow" bug, but rather a memory-hogging
bug (due to combinatorial explosion when many Automake conditionals
had to be handled) which could easily crash the whole system, which
is unacceptable.  The requirement of a proper and working 'ulimit'
builtin might cause the test to be skipped on more systems, but
that shouldn't be a problem since the bug isn't about a portability
issue, but is rather an automake internal implementation problem.
I've verified that the test as updated by this patch still passes
with automake 1.8.5, automake 1.10.2, and obviously the development
version of automake, and that it fails with automake 1.7.9.
---
 ChangeLog         |   17 +++++++++++++++++
 tests/cond29.test |   22 +++++++++-------------
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bf7fb8b..64c8892 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2011-06-01  Stefano Lattarini  <address@hidden>
 
+       tests: prefer ulimit over timeout in test on a memory-hogging bug
+       * tests/cond29.test: Use 'ulimit' instead of 'timeout' to ensure
+       that automake does not uses up too much resources.  This is really
+       and improvement because the bug tested by this script wasn't just
+       a "it hangs" or "it runs too slow" bug, but rather a memory-hogging
+       bug (due to combinatorial explosion when many Automake conditionals
+       had to be handled) which could easily crash the whole system, which
+       is unacceptable.  The requirement of a proper and working 'ulimit'
+       builtin might cause the test to be skipped on more systems, but
+       that shouldn't be a problem since the bug isn't about a portability
+       issue, but is rather an automake internal implementation problem.
+       I've verified that the test as updated by this patch still passes
+       with automake 1.8.5, automake 1.10.2, and obviously the development
+       version of automake, and that it fails with automake 1.7.9.
+
+2011-06-01  Stefano Lattarini  <address@hidden>
+
        testsuite: avoid generating `*-p.test' tests, use a wrapper script
        The generated `*-p.test' tests had already become just thin layers
        around the corresponding test scripts.  This change makes the final
diff --git a/tests/cond29.test b/tests/cond29.test
index 222743c..b07a7a9 100755
--- a/tests/cond29.test
+++ b/tests/cond29.test
@@ -16,17 +16,9 @@
 
 # Check that many conditions do not lead to combinatorial explosion.
 # (This is related to PR/352.)
-#
-# On this test, Automake 1.7.x would compute all 2**22 = 4194304
-# possible combinations of conditionals (it would do this five times,
-# to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
-# a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
-# or cpu time it can found.
 
 . ./defs || Exit 1
 
-timeout 10s true || skip_ "timeout command not found"
-
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<EOF
@@ -35,6 +27,14 @@ a02_LDADD =
 a03_SOURCES =
 EOF
 
+# On this test, Automake 1.7.x would compute all 2**22 = 4194304
+# possible combinations of conditionals (it would do this five times,
+# to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
+# a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
+# or cpu time it can found.
+ulimit -v 20000 || skip_ "no adequate 'ulimit' builtin found"
+(ulimit -v 1; sh -c 'exit 0') && skip_ "no adequate 'ulimit' builtin found"
+
 for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22; do
   unindent >>Makefile.am <<EOF
     if C$i
@@ -49,10 +49,6 @@ EOF
 done
 
 $ACLOCAL
-# Be lax w.r.t. the timeout for low-priority processes on heavily
-# loaded systems.
-niceness=`nice || echo 0`
-case $niceness in [0-9]*);; *) niceness=0;; esac
-timeout `expr 60 '+' $niceness '*' 20`s $AUTOMAKE
+$AUTOMAKE
 
 :
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]