automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Improve and extend test cond5.test.


From: Stefano Lattarini
Subject: [PATCH] Improve and extend test cond5.test.
Date: Thu, 3 Jun 2010 19:45:10 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

Hello automakers.

The test cond5.test can fail spuriously due to timeouts when it's run 
in low priority (e.g. with `nice -n19'), especially on loaded systems, 
or when many tests are run in parallel (I myself routinely run up to
50 tests in parallel with low priority).  This patch should solve this 
problem.  Since I was at it, I made also other few improvements and 
additions to the test.

Regards,
   Stefano

-*-*-*-

Improve and extend test cond5.test. 

* tests/cond5.test: Enable `errexit' flag, and related changes.
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).  Finally, check also the automake's
exist status and standard error.
From f712adf435e64d5582e131b33f64a81c4a4d6be7 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Thu, 3 Jun 2010 19:37:21 +0200
Subject: [PATCH] Improve and extend test cond5.test.

* tests/cond5.test: Enable `errexit' flag, and related changes.
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).  Finally, check also the automake's
exist status and standard error.
---
 ChangeLog        |   11 +++++++++++
 tests/cond5.test |   36 +++++++++++++++++++++++++-----------
 2 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f8c2dc3..504274a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-03  Stefano Lattarini  <address@hidden>
+
+       Improve and extend test cond5.test.
+       * tests/cond5.test: Enable `errexit' flag, and related changes.
+       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).  Finally, check also the automake's
+       exist status and standard error.
+
 2010-05-23  Stefano Lattarini  <address@hidden>
 
        Extend test on `nostdinc' automake option.
diff --git a/tests/cond5.test b/tests/cond5.test
index 531cda8..f28203b 100755
--- a/tests/cond5.test
+++ b/tests/cond5.test
@@ -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
@@ -18,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
@@ -41,15 +44,26 @@ 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
+(set +x; set +e; $AUTOMAKE 2>stderr; echo $? >status) &
 pid=$!
 
-sleep 60
-kill -0 $pid && {
-   kill $pid
-   Exit 1
-}
-Exit 0
+# Make at most 30 tries, 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
+    # Automake must fail ...
+    test 1 = "`cat status`"
+    # ... with a proper error message.
+    grep 'variable.*OPT_SRC.*recursively defined' stderr
+    Exit 0
+  fi
+done
+kill $pid
+Exit 1
-- 
1.6.5


reply via email to

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