]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: prefer ulimit over timeout in test on a memory-hogging bug
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 1 Jun 2011 10:09:23 +0000 (12:09 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 1 Jun 2011 14:35:08 +0000 (16:35 +0200)
* 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
tests/cond29.test

index bf7fb8bb33ff3f098461437f870add5805b7286b..64c8892fa83782554de248f059e7eb35f5db86ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        testsuite: avoid generating `*-p.test' tests, use a wrapper script
index 222743c98dbb2d5c2a9ee23cd147f1bfb4a13912..b07a7a9cacba556b9cf430d3c45bea2b48f6e47c 100755 (executable)
 
 # 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
 
 :