automake-patches
[Top][All Lists]
Advanced

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

[RFC+PATCHES] Refactoring `tests/defs.in'.


From: Stefano Lattarini
Subject: [RFC+PATCHES] Refactoring `tests/defs.in'.
Date: Wed, 1 Sep 2010 23:35:47 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hello automakers.

I think it's about time to start the refactoring of `tests/defs.in'
we spoke about many times in the past.

I'd like to do this in small steps, posting one or two patches at the 
time and waiting to have them reviewed/approved before posting the
following ones (thus avoding a "diff-bomb" of a patch series with
twenty patches or more).

I moreover think that this refactoring should be done in *two* public 
branches (e.g. "sl-tests-init-refactor-maint", stemmed from maint, and
"sl-tests-init-refactor-master", stemmed from master).  This is
required becase:
  1. `test/defs.in' in master differs from `test/defs.in' in maint,
     so that a refactoring step which is complete in maint might be
     incomplete in master;
  2. some changes to `tests/defs.in' will entail related changes to
     various test scripts, and some of these test scripts might be in
     master only.

Opinions?

In the meantime, I have prepared and attached a couple of (mostly
cosmetic) patches extracted from my old private branch.

Regards,
   Stefano
From 737c959b177457051e780fc8e9cdfc0f0706dd95 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 2 Jun 2010 21:23:34 +0200
Subject: [PATCH 1/2] Improve code for requiring libtool and gettext in tests.

* tests/defs.in: Stricter (and more correct) detection of wheter
libtool, libtoolize and/or gettext are in $required.
---
 ChangeLog     |    6 ++++++
 tests/defs.in |   10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 688f4be..aaa6604 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-01  Stefano Lattarini  <address@hidden>
+
+       Improve code for requiring libtool and gettext in tests.
+       * tests/defs.in: Stricter (and more correct) detection of wheter
+       libtool, libtoolize and/or gettext are in $required.
+
 2010-08-27  Stefano Lattarini  <address@hidden>
 
        Fix bug in test missing6.test.
diff --git a/tests/defs.in b/tests/defs.in
index 1744a07..1b7705b 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -330,8 +330,8 @@ echo "=== Running test $0"
 # files from an old version of Automake that we don't want to use.
 # Use `-Wno-syntax' because we do not want our test suite to fail because
 # some third-party .m4 file is underquoted.
-case $required in
-  *libtool* | *gettext* )
+case " $required " in
+  *\ libtool\ * | *\ libtoolize\ * | *\ gettext\ * )
     aclocaldir='@prefix@/share/aclocal'
     extra_includes=""
     if test -f $aclocaldir/dirlist; then
@@ -352,9 +352,9 @@ case $required in
          gettext_found=yes
        fi
     done
-    case $required in
-      *libtool* ) test $libtool_found = yes || Exit 77 ;;
-      *gettext* ) test $gettext_found = yes || Exit 77 ;;
+    case " $required " in
+      *\ libtool\ | *\ libtoolize\ * ) test $libtool_found = yes || Exit 77 ;;
+      *\ gettext\ * ) test $gettext_found = yes || Exit 77 ;;
     esac
     # Libtool cannot cope with spaces in the build tree.  Our testsuite setup
     # cannot cope with spaces in the source tree name for Libtool and gettext
-- 
1.7.1

From dd1fa96da3d3f970801354f401070c4ab84ee9a2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 2 Jun 2010 21:29:20 +0200
Subject: [PATCH 2/2] Tests defs: make spacing more consistent.

* tests/defs.in: Make spacing more consistent, especially w.r.t.
parentheses in subshells and case statements.  Indent only using
spaces, not tabs.  Also, move a comment to a better position.
---
 ChangeLog     |    5 +++++
 tests/defs.in |   52 ++++++++++++++++++++++++++--------------------------
 2 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aaa6604..b1249e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-09-01  Stefano Lattarini  <address@hidden>
 
+       Tests defs: make spacing more consistent.
+       * tests/defs.in: Make spacing more consistent, especially w.r.t.
+       parentheses in subshells and case statements.  Indent only using
+       spaces, not tabs.  Also, move a comment to a better position.
+
        Improve code for requiring libtool and gettext in tests.
        * tests/defs.in: Stricter (and more correct) detection of wheter
        libtool, libtoolize and/or gettext are in $required.
diff --git a/tests/defs.in b/tests/defs.in
index 1b7705b..40bc10f 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -95,12 +95,12 @@ do
       YACC='bison -y'
       export YACC
       echo "$me: running bison --version"
-      ( bison --version ) || exit 77
+      (bison --version) || exit 77
       ;;
     bzip2)
       # Do not use --version, bzip2 still tries to compress stdin.
       echo "$me: running bzip2 --help"
-      ( bzip2 --help ) || exit 77
+      (bzip2 --help) || exit 77
       ;;
     etags)
       # Exuberant Ctags will create a TAGS file even
@@ -108,14 +108,14 @@ do
       # does not have such problem.)  Use -o /dev/null
       # to make sure we do not pollute the tests/ directory.
       echo "$me: running etags --version -o /dev/null"
-      ( etags --version -o /dev/null ) || exit 77
+      (etags --version -o /dev/null) || exit 77
       ;;
     GNUmake)
       # Use --version AND -v, because SGI Make doesn't fail on --version.
       # Also grep for GNU because newer versions of FreeBSD make do
       # not complain about `--version' (they seem to silently ignore it).
       echo "$me: running $MAKE --version -v | grep GNU"
-      ( $MAKE --version -v | grep GNU ) || exit 77
+      ($MAKE --version -v | grep GNU) || exit 77
       ;;
     gcc)
       # When gcc is required, export `CC=gcc' so that ./configure
@@ -125,20 +125,20 @@ do
       CC=gcc
       export CC
       echo "$me: running $CC --version"
-      ( $CC --version ) || exit 77
+      ($CC --version) || exit 77
       ;;
     gcj)
       GCJ=gcj
       export GCJ
       echo "$me: running $GCJ --version"
-      ( $GCJ --version ) || exit 77
-      ( $GCJ -v ) || exit 77
+      ($GCJ --version) || exit 77
+      ($GCJ -v) || exit 77
       ;;
     g++)
       CXX=g++
       export CXX
       echo "$me: running $CXX --version"
-      ( $CXX --version ) || exit 77
+      ($CXX --version) || exit 77
       ;;
     icc)
       CC=icc
@@ -148,16 +148,16 @@ do
       # it will try link *nothing* and complain it cannot find
       # main(); funny).  Use -help so it does not try linking anything.
       echo "$me: running $CC -V -help"
-      ( $CC -V -help ) || exit 77
+      ($CC -V -help) || exit 77
       ;;
     makedepend)
       echo "$me: running makedepend -f-"
-      ( makedepend -f- ) || exit 77
+      (makedepend -f-) || exit 77
       ;;
     makeinfo-html)
       # Make sure makeinfo understands --html.
       echo "$me: running makeinfo --html --version"
-      ( makeinfo --html --version ) || exit 77
+      (makeinfo --html --version) || exit 77
       ;;
     non-root)
       # Skip this test case if the user is root.
@@ -173,7 +173,7 @@ do
     python)
       # Python doesn't support --version, it has -V
       echo "$me: running python -V"
-      ( python -V ) || exit 77
+      (python -V) || exit 77
       ;;
     ro-dir)
       # Skip this test case if read-only directories aren't supported
@@ -189,11 +189,11 @@ do
     rst2html)
       # Try the variants that are tried in check.am.
       while :; do
-       for r2h in $RST2HTML rst2html rst2html.py; do
-         echo "$me: running $r2h --version"
-         $r2h --version && break 2
-       done
-       exit 77
+        for r2h in $RST2HTML rst2html rst2html.py; do
+          echo "$me: running $r2h --version"
+          $r2h --version && break 2
+        done
+        exit 77
       done
       ;;
     runtest)
@@ -211,12 +211,12 @@ do
     texi2dvi-o)
       # Texi2dvi supports `-o' since Texinfo 4.1.
       echo "$me: running texi2dvi -o /dev/null --version"
-      ( texi2dvi -o /dev/null --version ) || exit 77
+      (texi2dvi -o /dev/null --version) || exit 77
       ;;
-    # Generic case: the tool must support --version.
     *)
+      # Generic case: the tool must support --version.
       echo "$me: running $tool --version"
-      ( $tool --version ) || exit 77
+      ($tool --version) || exit 77
       ;;
   esac
 done
@@ -331,7 +331,7 @@ echo "=== Running test $0"
 # Use `-Wno-syntax' because we do not want our test suite to fail because
 # some third-party .m4 file is underquoted.
 case " $required " in
-  *\ libtool\ * | *\ libtoolize\ * | *\ gettext\ * )
+  *\ libtool\ *|*\ libtoolize\ *|*\ gettext\ *)
     aclocaldir='@prefix@/share/aclocal'
     extra_includes=""
     if test -f $aclocaldir/dirlist; then
@@ -346,21 +346,21 @@ case " $required " in
     for d in $extra_includes $aclocaldir ; do
        test "x$d" != x-I || continue
        if test -f "$d/libtool.m4"; then
-         libtool_found=yes
+         libtool_found=yes
        fi
        if test -f "$d/gettext.m4"; then
-         gettext_found=yes
+         gettext_found=yes
        fi
     done
     case " $required " in
-      *\ libtool\ | *\ libtoolize\ * ) test $libtool_found = yes || Exit 77 ;;
-      *\ gettext\ * ) test $gettext_found = yes || Exit 77 ;;
+      *\ libtool\ *|*\ libtoolize\ *) test $libtool_found = yes || Exit 77;;
+      *\ gettext\ *) test $gettext_found = yes || Exit 77;;
     esac
     # Libtool cannot cope with spaces in the build tree.  Our testsuite setup
     # cannot cope with spaces in the source tree name for Libtool and gettext
     # tests.
     case $srcdir,`pwd` in
-      *\ * | *\        *) Exit 77 ;;
+      *\ *|*\  *) Exit 77;;
     esac
     ACLOCAL="$ACLOCAL -Wno-syntax -I $srcdir/../m4 $extra_includes -I 
$aclocaldir"
     ;;
-- 
1.7.1


reply via email to

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