automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and ext


From: Stefano Lattarini
Subject: Re: [PATCH] {maint} Warnings about primary/prefix mismatch fixed and extended.
Date: Mon, 13 Jun 2011 11:00:35 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Monday 13 June 2011, Stefano Lattarini wrote:
> 
> I've pushed the patch now.
> 
> Regards,
>   Stefano
> 
But the test `primary-prefix-invalid-couples.test' is really too slow.
What about the attached follow-up patch to improve the situation?  It
slightly reduces coverage, but on my system bring the test execution
time from six minutes to fifteen seconds, so it's a good trade-off
IMHO.

I'll push in 48 hours if there is no objection by then.

Regards,
  Stefano
From ed078daae2110f79322c79826be567645ef62ea4 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Mon, 13 Jun 2011 10:51:57 +0200
Subject: [PATCH] tests: optimize tests on primary/prefix mismatch for speed

* tests/primary-prefix-invalid-couples.test: Partial rewrite, in
order to use just a single automake invocation rather than one
invocation for each invalid primary/prefix couple.  This improves
the test script execution time by an order of magnitude.
Since we are at it, throw in some other improvements to avoid
unrelated automake warnings and failures that could potentially
cause false positives w.r.t. the automake exit status.
---
 ChangeLog                                 |   11 ++++
 tests/primary-prefix-invalid-couples.test |   73 +++++++++++++++++++++++------
 2 files changed, 70 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 61be149..e54e01d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-06-13  Stefano Lattarini  <address@hidden>
+
+       tests: optimize tests on primary/prefix mismatch for speed
+       * tests/primary-prefix-invalid-couples.test: Partial rewrite, in
+       order to use just a single automake invocation rather than one
+       invocation for each invalid primary/prefix couple.  This improves
+       the test script execution time by an order of magnitude.
+       Since we are at it, throw in some other improvements to avoid
+       unrelated automake warnings and failures that could potentially
+       cause false positives w.r.t. the automake exit status.
+
 2011-06-11  Stefano Lattarini  <address@hidden>
 
        Warnings about primary/prefix mismatch fixed and extended.
diff --git a/tests/primary-prefix-invalid-couples.test 
b/tests/primary-prefix-invalid-couples.test
index e80b4c2..88e0817 100755
--- a/tests/primary-prefix-invalid-couples.test
+++ b/tests/primary-prefix-invalid-couples.test
@@ -26,10 +26,17 @@ set -e
 
 oIFS=$IFS # Saved for later.
 
+: > ltmain.sh
+: > texinfo.tex
+: > elisp-comp
+: > py-compile
+: > config.guess
+: > config.sub
+
 cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_RANLIB
-AC_PROG_LIBTOOL
+AC_SUBST([LIBTOOL], [:]) dnl So that we don't have to require Libtool.
 AM_PROG_GCJ
 AM_PATH_PYTHON
 AM_PATH_LISPDIR
@@ -58,7 +65,7 @@ set +x # Don't be overly verbose.
 
 for prefix in $prefixes; do
   for primary in $primaries; do
-    echo ${prefix}_${primary}
+    echo ${prefix} ${primary}
   done
 done >all.list
 
@@ -120,23 +127,61 @@ for primary in $primaries; do
   done
 done >allow.list
 
-set -x # Restore shell xtraces from now on.
+# `html_TEXINFOS' is not yet supported, and might never be.
+grep -v '^html TEXINFOS$' all.list | awk '{print NR, $0}' > t
+mv -f t all.list
 
+# For debugging.
+echo '=== all.list ==='
 cat all.list
+echo '=== allow.list ==='
 cat allow.list
 
-while read x; do
-  grep "^$x$" allow.list >/dev/null && continue
-  # To get the expected error message more in detail.
-  IFS=_; set $x; IFS=$oIFS
-  test $# -eq 2 || fatal_ "internal error in 'all.list'" # Sanity check.
-  prefix=$1
-  primary=$2
+# Create the Makefile.am.
+while read lineno prefix primary; do
+  test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
+    || fatal_ "internal error in 'all.list'"
+  pfx='' ext=''
+  case $primary in
+    LTLIBRARIES) pfx=lib ext=la;;
+    LIBRARIES) pfx=lib ext=a;;
+    MANS) ext=man;;
+    HEADERS) ext=h;;
+    JAVA) ext=java;;
+    PYTHON) ext=py;;
+    LISP) ext=el;;
+    TEXINFOS) ext=texi;;
+  esac
+  test -z "$ext" || ext=.$ext
+  if test $primary = TEXINFOS; then
+    echo @setfilename foo$lineno.info > foo$lineno.texi
+  fi
+  echo ${prefix}_${primary} = ${pfx}foo${lineno}${ext}
+done <all.list >Makefile.am
+
+# For debugging.
+echo '=== Makefile.am ==='
+cat Makefile.am
+
+set -x # Restore shell xtraces from now on.
+
+AUTOMAKE_fails -a
+
+while read lineno prefix primary; do
+  test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
+    || fatal_ "internal error in 'all.list'"
+  grep "^${prefix}_${primary}$" allow.list >/dev/null && continue
   errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary"
-  # Now do the test for this prefix/primary combination.
-  echo "$x = foo" > Makefile.am
-  AUTOMAKE_fails -a || Exit 1
-  grep "^Makefile\\.am:1:$errmsg_rx" stderr || Exit 1
+  grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr || Exit 1
 done <all.list
 
+# Check that automake really failed only for the expected reason(s).
+grep -v 'dir.* not a legitimate directory' stderr && Exit 1
+
+# Check that the same failures are present without the `--add-missing'
+# option.
+mv stderr stderr.old
+AUTOMAKE_fails
+diff stderr.old stderr
+
 :
-- 
1.7.2.3


reply via email to

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