Subject: bug#10374: 3 test failures on fedora 16

From: Stefano Lattarini <[email-masked]>
Date: Tue, 27 Dec 2011 11:58:29 +0100

On 12/27/2011 11:35 AM, Jim Meyering wrote:
> Stefano Lattarini wrote:
>> On 12/26/2011 11:26 PM, Jim Meyering wrote:
>>> FAIL: cond29
>>> ============
> ...
>>> + aclocal-1.11a -Werror
>>> /usr/bin/perl: error while loading shared libraries:
>>>   libc.so.6: failed to map segment from shared object:
>>>   Cannot allocate memory
>>>
>> Ah-ah, memory ulimit contraints imposed by ulimit above:
>>
>>   ulimit -v 20000
>>
>> seems to be too tight.  I can reproduce a similar failure on the Fedora
>> 16 system (on pcc64 machine) at the GCC compile farm, and fix it with
>> the attached patch.  Does that patch works for you as well?
>>
>>> + exit_status=127
>>> + set +e
>>> + cd /h/j/w/co/automake/tests
>>> + test no = yes
>>> + case $am_explicit_skips in
>>> + test 127 -eq 0
>>> + keep_testdirs=yes
>>> + am_keeping_testdirs
>>> + case $keep_testdirs in
>>> + return 0
>>> + set +x
>>> cond29: exit 127
> 
> With a 50-MB limit, I see this failure on x86_64:
> 
>   + echo 'AM_CONDITIONAL([C24], [:])'
>   + aclocal-1.11a -Werror
>   + automake-1.11a --foreign -Werror -Wall
>   Out of memory!
>   Out of memory!
>   + exit_status=1
>   + set +e
>   + cd /h/j/w/co/automake/tests
>   + test no = yes
>   + case $am_explicit_skips in
>   + test 1 -eq 0
>   + keep_testdirs=yes
>   + am_keeping_testdirs
>   + case $keep_testdirs in
>   + return 0
>   + set +x
>   cond29: exit 1
> 
> Same with 60MB, but it passes with 70MB.
> So I suggest changing s/50/70/ in both the patch and the log message.
> Maybe even 90 or 100, just to be a little more future/bloat-proof.
>
Since we are being liberal already, let's go for 150 MB then ;-)

What about the updated, attached patch?

Stefano
>From 9b06cda000e86888abfc9999b4c66ab8df10873a Mon Sep 17 00:00:00 2001
Message-Id: <9b06cda00[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Tue, 27 Dec 2011 10:40:57 +0100
Subject: [PATCH] tests: fix spurious failure of cond29.test

* tests/cond29.test: Limit the amount of virtual memory available
to the automake process to ~ 150 MB, rather than only ~ 20 MB, to
account for higher (but still acceptable) memory usages on some
systems (in this case, a Fedora 16 distro on ppc64).  To be
sure not to reduce coverage, increase the number of potential
combinations of automake conditionals from 2**22 = 4194304 to
2**24 = 16777216.

We have actually verified that the new version of the test case
catches the Automake 1.7 it is intended to check against, using
the Automake 1.7.9 tarball downloaded from:
  <http://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz>

Reported by Jim Meyering in automake bug#10374.
---
 ChangeLog         |   16 ++++++++++++++++
 tests/cond29.test |   18 +++++++++++++-----
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dfe666a..e0122fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-12-27  Stefano Lattarini  <[email-masked]>
+
+	tests: fix spurious failure of cond29.test
+	* tests/cond29.test: Limit the amount of virtual memory available
+	to the automake process to ~ 150 MB, rather than only ~ 20 MB, to
+	account for higher (but still acceptable) memory usages on some
+	systems (in this case, a Fedora 16 distro on ppc64).  To be
+	sure not to reduce coverage, increase the number of potential
+	combinations of automake conditionals from 2**22 = 4194304 to
+	2**24 = 16777216.
+	We have actually verified that the new version of the test case
+	catches the Automake 1.7 it is intended to check against, using
+	the Automake 1.7.9 tarball downloaded from:
+	  <http://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz>
+	Reported by Jim Meyering in automake bug#10374.
+
 2011-12-24  Stefano Lattarini  <[email-masked]>
 
 	gitignore: use only one .gitignore file, in the top-level directory
diff --git a/tests/cond29.test b/tests/cond29.test
index 3361081..0443251 100755
--- a/tests/cond29.test
+++ b/tests/cond29.test
@@ -27,16 +27,24 @@ a02_LDADD =
 a03_SOURCES =
 EOF
 
-# On this test, Automake 1.7.x would compute all 2**22 = 4194304
+# On this test, Automake 1.7.x would compute all 2**24 = 16777216
 # 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.
+# Limit memory available to spawned processes to ~ 150 MB.  This might
+# seem too liberal, but it is needed to account for present and features
+# "bloating" of automake, perl, or even the C library (especially on 64
+# bit machines).  Suggested by Jim Meyering in automake bug#10374.
 (ulimit -v 1; sh -c ":") && skip_ "no adequate 'ulimit' builtin found"
-(ulimit -v 20000; sh -c ":") || skip_ "no adequate 'ulimit' builtin found"
-ulimit -v 20000
-
-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
+(ulimit -v 150000; sh -c ":") || skip_ "no adequate 'ulimit' builtin found"
+ulimit -v 150000
+
+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 23 24
+do
   unindent >>Makefile.am <<EOF
     if C$i
     bin_PROGRAMS += a$i
-- 
1.7.7.3