automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Enable `errexit' shell flag in some test scripts.


From: Stefano Lattarini
Subject: [PATCH] Enable `errexit' shell flag in some test scripts.
Date: Tue, 8 Jun 2010 16:20:39 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

Another patch to make the use of the `errexit' shell flag in the 
testsuite more uniform.

This patch shouldn't introduce any portability problem, since the
affected tests do not use shell functions, compound commands, nor
command substitutions.  Some of them do use the idiom:
  COMMAND >file || { cat file; Exit 1; }
(or variants of it), but this is done also in other tests which 
already use the `errexit' shell flag.

Regards,
    Stefano

-*-*-*-

Enable `errexit' shell flag in some test scripts.

* tests/subcond.test: Enabled `errexit' shell flag, and related
minor changes.
* tests/subst.test: Likewise.
* tests/tags.test: Likewise.
* tests/unused.test: Likewise.
* tests/vars.test: Likewise.
* tests/version4.test: Likewise.
* tests/vpath.test: Likewise.
* tests/vtexi2.test: Likewise.
* tests/werror.test: Likewise.
* tests/whoami.test: Likewise.
* tests/acsilent.test: Likewise, and don't use a command
substitution that can be easily avoided.
* tests/version.test: Enabled `errexit' shell flag, and related
minor changes.  Also, avoid deprecated constructs in the generated
`configure.in'.
* tests/version2.test: Likewise.

-*-*-*-

 ChangeLog           |   23 +++++++++++++++++++++++
 tests/acsilent.test |   10 +++++++---
 tests/subcond.test  |    7 +++++--
 tests/subst.test    |   12 ++++++++----
 tests/tags.test     |   10 +++++-----
 tests/unused.test   |   11 ++++++++---
 tests/vars.test     |    6 ++++--
 tests/version.test  |    9 ++++++---
 tests/version2.test |   11 +++++++----
 tests/version4.test |    6 ++++--
 tests/vpath.test    |    8 +++++---
 tests/vtexi2.test   |    9 ++++++---
 tests/werror.test   |    6 ++++--
 tests/whoami.test   |    5 ++++-
 14 files changed, 96 insertions(+), 37 deletions(-)
From a7dea524113eaa37aeea07c0837474a157d2f373 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Tue, 8 Jun 2010 16:09:18 +0200
Subject: [PATCH] Enable `errexit' shell flag in some test scripts.

* tests/subcond.test: Enabled `errexit' shell flag, and related
minor changes.
* tests/subst.test: Likewise.
* tests/tags.test: Likewise.
* tests/unused.test: Likewise.
* tests/vars.test: Likewise.
* tests/version4.test: Likewise.
* tests/vpath.test: Likewise.
* tests/vtexi2.test: Likewise.
* tests/werror.test: Likewise.
* tests/whoami.test: Likewise.
* tests/acsilent.test: Likewise, and don't use a command
substitution that can be easily avoided.
* tests/version.test: Enabled `errexit' shell flag, and related
minor changes.  Also, avoid deprecated constructs in the generated
`configure.in'.
* tests/version2.test: Likewise.
---
 ChangeLog           |   23 +++++++++++++++++++++++
 tests/acsilent.test |   10 +++++++---
 tests/subcond.test  |    7 +++++--
 tests/subst.test    |   12 ++++++++----
 tests/tags.test     |   10 +++++-----
 tests/unused.test   |   11 ++++++++---
 tests/vars.test     |    6 ++++--
 tests/version.test  |    9 ++++++---
 tests/version2.test |   11 +++++++----
 tests/version4.test |    6 ++++--
 tests/vpath.test    |    8 +++++---
 tests/vtexi2.test   |    9 ++++++---
 tests/werror.test   |    6 ++++--
 tests/whoami.test   |    5 ++++-
 14 files changed, 96 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a5af5af..63805f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2010-06-08  Stefano Lattarini  <address@hidden>
+
+       Enable `errexit' shell flag in some test scripts.
+       * tests/subcond.test: Enabled `errexit' shell flag, and related
+       minor changes.
+       * tests/subst.test: Likewise.
+       * tests/vars.test: Likewise.
+       * tests/version4.test: Likewise.
+       * tests/vpath.test: Likewise.
+       * tests/vtexi2.test: Likewise.
+       * tests/werror.test: Likewise.
+       * tests/whoami.test: Likewise.
+       * tests/tags.test: Likewise, and avoid to crate an useless dummy
+       header file.
+       * tests/acsilent.test: Likewise, and don't use an easily-avoided
+       command substitution.
+       * tests/unused.test: Likewise, and don't use an easily-avoided
+       command substitution.
+       * tests/version.test: Likewise, and avoid deprecated constructs
+       in the generated `configure.in'.
+       * tests/version2.test: Likewise, and avoid deprecated constructs
+       in the generated `configure.in'.
+
 2010-06-07  Stefano Lattarini  <address@hidden>
            Ralf Wildenhues  <address@hidden>
 
diff --git a/tests/acsilent.test b/tests/acsilent.test
index 6ac7863..abbfc92 100755
--- a/tests/acsilent.test
+++ b/tests/acsilent.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2008, 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 <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
@@ -32,5 +35,6 @@ module=[$1]
 AC_SUBST(module)])
 END
 
-$ACLOCAL > output 2>&1 || { cat output; Exit 1; }
-test -z "`cat output`"
+$ACLOCAL >output 2>&1 || { cat output; Exit 1; }
+cat output
+test ! -s output
diff --git a/tests/subcond.test b/tests/subcond.test
index b04c475..0269cac 100755
--- a/tests/subcond.test
+++ b/tests/subcond.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2006, 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
@@ -15,9 +15,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # It is ok to have a conditional SUBDIRS when using gettext.
+
 required=gettext
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AM_GNU_GETTEXT
 AM_CONDITIONAL(MAUDE, true)
@@ -36,6 +39,6 @@ SUBDIRS =
 endif
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 # Gettext wants config.guess etc.
 $AUTOMAKE --add-missing
diff --git a/tests/subst.test b/tests/subst.test
index 7d45dae..ebc73ca 100755
--- a/tests/subst.test
+++ b/tests/subst.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2007, 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
@@ -19,6 +20,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 dnl This test used to have the following lines, which cannot have
 dnl worked sensibly with Autoconf for years, however:
@@ -32,7 +35,8 @@ END
 
 : > Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 grep '^\$1' Makefile.in && Exit 1
-Exit 0
+
+:
diff --git a/tests/tags.test b/tests/tags.test
index 055989f..1eaf569 100755
--- a/tests/tags.test
+++ b/tests/tags.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,13 +19,13 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 noinst_HEADERS = iguana.h
 END
 
-: > iguana.h
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^ID:' Makefile.in
diff --git a/tests/unused.test b/tests/unused.test
index a5b4da6..f406b43 100755
--- a/tests/unused.test
+++ b/tests/unused.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2002, 2003, 2008, 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
@@ -15,8 +16,11 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for failing check for unused macros.  From Johan Danielsson.
+
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 MACRO_1
 MACRO_1_2
@@ -29,5 +33,6 @@ AC_DEFUN([MACRO_1_2], echo 12)
 AC_DEFUN([MACRO_1_2_3], echo 123)
 END
 
-$ACLOCAL 2> stderr || { cat stderr >&2; Exit 1; }
-test -z "`cat stderr`"
+$ACLOCAL 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+test ! -s stderr
diff --git a/tests/vars.test b/tests/vars.test
index ae711b0..6163a8d 100755
--- a/tests/vars.test
+++ b/tests/vars.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 MY_FLAGS_1=-DABC=345
 MY_FLAGS_2= -DABC=345
@@ -26,5 +28,5 @@ MY_FLAGS_3 =-DABC=345
 MY_FLAGS_4 = -DABC=345
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
diff --git a/tests/version.test b/tests/version.test
index bfa3f43..a894a75 100755
--- a/tests/version.test
+++ b/tests/version.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,10 +19,13 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE([sh-utils], [1.12o])
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
 END
 
 : > Makefile.am
@@ -36,5 +39,5 @@ END
 : > ChangeLog
 : > THANKS
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE --gnits
diff --git a/tests/version2.test b/tests/version2.test
index 993c0ba..a25b82b 100755
--- a/tests/version2.test
+++ b/tests/version2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1997, 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
@@ -19,10 +19,13 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > configure.in << 'END'
 AC_INIT
-AM_INIT_AUTOMAKE([sh-utils], 1.12o, no)
-AC_OUTPUT(Makefile)
+AM_INIT_AUTOMAKE([sh-utils], [1.12o], [no])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
 END
 
 : > Makefile.am
@@ -36,5 +39,5 @@ END
 : > ChangeLog
 : > THANKS
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE --gnits
diff --git a/tests/version4.test b/tests/version4.test
index 9ec0cba..f8ceafe 100755
--- a/tests/version4.test
+++ b/tests/version4.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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,9 +18,11 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = 1.4-p3
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
diff --git a/tests/vpath.test b/tests/vpath.test
index 850aaeb..a95f5b2 100755
--- a/tests/vpath.test
+++ b/tests/vpath.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,12 +19,14 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 VPATH = zardoz
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep 'address@hidden@' Makefile.in && Exit 1
 Exit 0
diff --git a/tests/vtexi2.test b/tests/vtexi2.test
index 633fe13..e1a1b93 100755
--- a/tests/vtexi2.test
+++ b/tests/vtexi2.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 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
@@ -21,6 +22,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = zardoz.texi
 END
@@ -34,7 +37,7 @@ END
 : > mdate-sh
 : > texinfo.tex
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^zardoz\.dvi:' Makefile.in
diff --git a/tests/werror.test b/tests/werror.test
index 5c7a0b5..355f9d2 100755
--- a/tests/werror.test
+++ b/tests/werror.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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,9 +18,11 @@
 
 . ./defs || Exit 1
 
+set -e
+
 : > Makefile.am
 
 rm -f install-sh depcomp missing mkinstalldirs
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE --Werror --add-missing
diff --git a/tests/whoami.test b/tests/whoami.test
index f2dcab1..37bd81a 100755
--- a/tests/whoami.test
+++ b/tests/whoami.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 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
@@ -17,8 +17,11 @@
 # Test to make sure aclocal doesn't barf on "WHO_AM_I=...".  Report
 # from Johan Danielsson (and a very nice bug report, too, I might
 # add).
+
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 WHO_AM_I=17
 END
-- 
1.6.5


reply via email to

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