]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Improve and extend test cond5.test.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 3 Jun 2010 17:37:21 +0000 (19:37 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 18 Jul 2010 10:17:13 +0000 (12:17 +0200)
* tests/cond5.test: Do not blindly sleep 60 seconds before polling
the background automake process, but poll it every 10 seconds for
at most 30 times (this makes the test both faster on good machines,
and more resilient to spurious timeout-due failures when in low
priority or on havily-loaded systems).
Check also that automake writes the expected error messages on the
standard error.
Enable `errexit' flag, and related changes.
Rely on the `configure.in' stub created by `./defs', rather than
writing one from scratch.

ChangeLog
tests/cond5.test

index a5efdc2e9721baff0d4369f045b53511cb87b9eb..251ff2e8473897116791d6fbbcf5496371f64501 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend test cond5.test.
+       * tests/cond5.test: Do not blindly sleep 60 seconds before polling
+       the background automake process, but poll it every 10 seconds for
+       at most 30 times (this makes the test both faster on good machines,
+       and more resilient to spurious timeout-due failures when in low
+       priority or on havily-loaded systems).
+       Check also that automake writes the expected error messages on the
+       standard error.
+       Enable `errexit' flag, and related changes.
+       Rely on the `configure.in' stub created by `./defs', rather than
+       writing one from scratch.
+
 2010-06-26  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Update program --help output to match current GCS.
index 531cda8a58f8294384c6b9cc45799154763e44d5..84afdd01db1117709d313329a17c98516e8b7e8e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
+# Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(ONE, true)
-AM_CONDITIONAL(TWO, false)
-AC_OUTPUT(Makefile)
+AM_CONDITIONAL([ONE], [true])
+AM_CONDITIONAL([TWO], [false])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -41,15 +42,27 @@ endif
 targ_SOURCES = main.c $(OPT_SRC)
 END
 
-# The bug is that automake hangs.  So we give it a few seconds and
-# then kill it.
-$ACLOCAL || Exit 1
-$AUTOMAKE &
+# The bug is that automake hangs.  So we give it an appropriate grace
+# time, then kill it if necessary.
+$ACLOCAL
+$AUTOMAKE 2>stderr &
 pid=$!
 
-sleep 60
-kill -0 $pid && {
-   kill $pid
-   Exit 1
-}
-Exit 0
+# Make at most 30 tries, one every 10 seconds (= 300 seconds = 5 min).
+try=1
+while test $try -le 30; do
+  if kill -0 $pid; then
+    : process $pid is still alive, wait and retry
+    sleep 10
+    try=`expr $try + 1`
+  else
+    cat stderr >&2
+    # Automake must fail with a proper error message.
+    grep 'variable.*OPT_SRC.*recursively defined' stderr
+    Exit 0
+  fi
+done
+# The automake process probably hung.  Kill it, and exit with failure.
+echo "$me: automake process $pid hung"
+kill $pid
+Exit 1