automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Tweak, extend and improve tests `cond[a-z]*.test'.


From: Stefano Lattarini
Subject: Re: [PATCH] Tweak, extend and improve tests `cond[a-z]*.test'.
Date: Sun, 8 Aug 2010 19:42:39 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

At Sunday 08 August 2010, Ralf Wildenhues wrote:
> 
> > --- a/tests/condd.test
> > +++ b/tests/condd.test
> > 
> > @@ -64,7 +64,9 @@ mkdir foo bar
> > 
> >  $ACLOCAL
> >  $AUTOCONF
> > 
> > -grep "meaningless;characters" configure && Exit 1
> > +$FGREP "meaningless;characters" configure && Exit 1
> 
> Such changes are just noise, right?  As such, I don't think they
> improve the testsuite, they only add work to possible history
> digging later.
Agreed; dropped.

> 
> > --- a/tests/condhook.test
> > +++ b/tests/condhook.test
> > 
> > @@ -22,15 +23,16 @@
> > 
> >  set -e
> >  
> >  cat >> configure.in << 'END'
> > 
> > -AM_CONDITIONAL(TEST, false)
> > +AM_CONDITIONAL([TEST], [false])
> > 
> >  AC_OUTPUT
> >  END
> >  
> >  cat > Makefile.am << 'END'
> > 
> > -sysconf_DATA = mumble
> > +datadir = $(prefix)/data
> > +data_DATA = mumble
> 
> Why this change?  To me, this is just more complex noise, because
> harder to understand; or is there an actual bug in the test fixed
> by this?
No, it was just to make the final location of installed data more 
explicit: it's not immediate that $(sysconfdir) is $(prefix)/etc
by default. However, this default documented by the Automake manual 
and the GNU coding standards, so I'll drop this change and update the 
new checks accordingly (very easy to do).  Ditto for condhook2.test.

> > --- a/tests/condinc2.test
> > +++ b/tests/condinc2.test
> > @@ -22,9 +22,11 @@
> > 
> >  set -e
> >  
> >  cat >> configure.in << 'END'
> > 
> > -AM_CONDITIONAL(TOBE, false)
> > +AM_CONDITIONAL([TOBE], [false])
> > 
> >  END
> > 
> > +$ACLOCAL
> > +
> > 
> >  cat > Makefile.am << 'END'
> >  if TOBE
> >  include adjunct
> > 
> > @@ -37,7 +39,6 @@ target: dependency
> > 
> >  endif
> >  END
> > 
> > -$ACLOCAL
> > 
> >  AUTOMAKE_fails
> 
> Again, this moving of $ACLOCAL is noise, right?
Basically yes, even if I prefer to have aclocal called early when the 
Makefile.am is modified and processed several times.  Dropped this one
too (even if a little grumpily ;-).

> The rest seems good for maint, thanks.
BTW, the patch was against master, and while rebasing it I saw (well, 
a merge conflict made me see) that I could backport some extra checks
in condinc2.test from master to maint.  I did that, too.

The updated patch is attached.

Regards,
  Stefano
From 6aeee25cc228652121e6b01c66b97e7148f377f6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 14 Jul 2010 15:22:12 +0200
Subject: [PATCH] Tweak, extend and improve tests `cond[a-z]*.test'.

* tests/condd.test: Add trailing `:' command.  Typofix in
comment.
* tests/condhook.test: Make sure target `install-data-hook' is
not called by `make install', but that data files are installed.
Use proper m4 quoting in configure.in. Add trailing `:' command.
* tests/condhook2.test: New test, sister test of condhook, with
inverted semantic.
* tests/condinc2.test: Use proper m4 quoting in configure.in.
Prefer trailing `:' command over trailing `Exit 0'.  Add new
checks, backported from master.
* tests/condman2.test: Enable errexit shell flag, and related
changes.  Add trailing `:' command.
* tests/condman.test: Likewise.  Also, do not create useless
dummy manpages, and use proper m4 quoting in configure.in.
* tests/condman3.test: New test, similar to condman.test, but
it also runs ./configure and "make install", and check the
installed files.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog            |   20 +++++++++++++++
 tests/Makefile.am    |    2 +
 tests/Makefile.in    |    2 +
 tests/condd.test     |    6 +++-
 tests/condhook.test  |   13 +++++++--
 tests/condhook2.test |   49 +++++++++++++++++++++++++++++++++++++
 tests/condinc2.test  |   22 ++++++++++++++++-
 tests/condman.test   |   14 ++++++----
 tests/condman2.test  |   17 ++++++++----
 tests/condman3.test  |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 192 insertions(+), 18 deletions(-)
 create mode 100755 tests/condhook2.test
 create mode 100755 tests/condman3.test

diff --git a/ChangeLog b/ChangeLog
index b22a2e3..d4a9a09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2010-08-08  Stefano Lattarini  <address@hidden>
 
+       Tweak, extend and improve tests `cond[a-z]*.test'.
+       * tests/condd.test: Add trailing `:' command.  Typofix in
+       comment.
+       * tests/condhook.test: Make sure target `install-data-hook' is
+       not called by `make install', but that data files are installed.
+       Use proper m4 quoting in configure.in. Add trailing `:' command.
+       * tests/condhook2.test: New test, sister test of condhook, with
+       inverted semantic.
+       * tests/condinc2.test: Use proper m4 quoting in configure.in.
+       Prefer trailing `:' command over trailing `Exit 0'.  Add new
+       checks, backported from master.
+       * tests/condman2.test: Enable errexit shell flag, and related
+       changes.  Add trailing `:' command.
+       * tests/condman.test: Likewise.  Also, do not create useless
+       dummy manpages, and use proper m4 quoting in configure.in.
+       * tests/condman3.test: New test, similar to condman.test, but
+       it also runs ./configure and "make install", and check the
+       installed files.
+       * tests/Makefile.am (TESTS): Updated.
+
        Modernize, improve and/or extend tests `colon*.test.
        * tests/colon.test: Rely on the `configure.in' stub created by
        `./defs', rather than writing one from scratch.  Do not create
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e1c94bc..0558149 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -207,11 +207,13 @@ cond44.test \
 cond45.test \
 condd.test \
 condhook.test \
+condhook2.test \
 condinc.test \
 condinc2.test \
 condlib.test \
 condman.test \
 condman2.test \
+condman3.test \
 configure.test \
 confdeps.test \
 conff.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a7a6bab..a06026e 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -445,11 +445,13 @@ cond44.test \
 cond45.test \
 condd.test \
 condhook.test \
+condhook2.test \
 condinc.test \
 condinc2.test \
 condlib.test \
 condman.test \
 condman2.test \
+condman3.test \
 configure.test \
 confdeps.test \
 conff.test \
diff --git a/tests/condd.test b/tests/condd.test
index 0e9b6e8..b70d691 100755
--- a/tests/condd.test
+++ b/tests/condd.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
@@ -23,7 +23,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 dnl Define a macro with the same name as the conditional to exhibit
-dnl any underquotted bug.
+dnl any underquoted bug.
 AC_DEFUN([COND1], ["some'meaningless;characters`])
 AM_CONDITIONAL([COND1], false)
 AC_CONFIG_FILES([foo/Makefile])
@@ -68,3 +68,5 @@ grep "meaningless;characters" configure && Exit 1
 $AUTOMAKE
 ./configure
 $MAKE test
+
+:
diff --git a/tests/condhook.test b/tests/condhook.test
index 06fa887..bf9225b 100755
--- a/tests/condhook.test
+++ b/tests/condhook.test
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test install when a conditional install-*-hook is not defined.
+# Keep this in sync with sister test condhook2.test.
 # Report by Nik A. Melchior (PR/428).
 
 . ./defs || Exit 1
@@ -22,7 +23,7 @@
 set -e
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL(TEST, false)
+AM_CONDITIONAL([TEST], [false])
 AC_OUTPUT
 END
 
@@ -30,7 +31,7 @@ cat > Makefile.am << 'END'
 sysconf_DATA = mumble
 if TEST
 install-data-hook:
-       echo foo
+       : > $(top_srcdir)/bad
 endif
 END
 
@@ -39,5 +40,11 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
+
 ./configure --prefix "`pwd`/inst"
+
 $MAKE install
+test -f inst/etc/mumble
+test ! -f bad
+
+:
diff --git a/tests/condhook2.test b/tests/condhook2.test
new file mode 100755
index 0000000..45e2d43
--- /dev/null
+++ b/tests/condhook2.test
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test install when a conditional install-*-hook is defined.
+# Keep this in sync with sister test condhook.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([TEST], [true])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+sysconf_DATA = mumble
+if TEST
+install-data-hook:
+       : > $(top_srcdir)/good
+endif
+END
+
+: > mumble
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix "`pwd`/inst"
+
+$MAKE install
+test -f inst/etc/mumble
+test -f good
+
+:
diff --git a/tests/condinc2.test b/tests/condinc2.test
index 088fb55..ada9339 100755
--- a/tests/condinc2.test
+++ b/tests/condinc2.test
@@ -21,7 +21,7 @@
 set -e
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL(TOBE, false)
+AM_CONDITIONAL([TOBE], [false])
 END
 
 cat > Makefile.am << 'END'
@@ -39,3 +39,23 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 grep 'adjunct:3: too many conditionals closed' stderr
+
+cat > adjunct << 'END'
+if TOBE
+target: dependency
+       rule
+END
+
+AUTOMAKE_fails
+grep 'unterminated conditionals' stderr
+
+cat > adjunct << 'END'
+if TOBE
+target: dependency
+       rule
+endif
+END
+
+$AUTOMAKE
+
+:
diff --git a/tests/condman.test b/tests/condman.test
index 3dc8bcd..ee2d41b 100755
--- a/tests/condman.test
+++ b/tests/condman.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 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
@@ -15,10 +15,13 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure conditionals work with man pages.
+
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
-AM_CONDITIONAL(FRED, true)
+AM_CONDITIONAL([FRED], [true])
 END
 
 cat > Makefile.am << 'END'
@@ -29,8 +32,7 @@ man_MANS = joe.1
 endif
 END
 
-: > foo.1
-: > joe.1
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/tests/condman2.test b/tests/condman2.test
index 0b448e2..c0e7216 100755
--- a/tests/condman2.test
+++ b/tests/condman2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 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
@@ -15,16 +15,21 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure appropriate man install targets generated in all cases.
+
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 man_MANS = foo.1 foo.2
 man5_MANS = foo.5
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+grep '^install-man1:' Makefile.in
+grep '^install-man2:' Makefile.in
+grep '^install-man5:' Makefile.in
 
-grep '^install-man1:' Makefile.in || Exit 1
-grep '^install-man2:' Makefile.in || Exit 1
-grep '^install-man5:' Makefile.in || Exit 1
+:
diff --git a/tests/condman3.test b/tests/condman3.test
new file mode 100755
index 0000000..ff93daf
--- /dev/null
+++ b/tests/condman3.test
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure conditionals work with man pages.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [test x"$FOO" = x"true"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+if COND
+man_MANS = foo.1
+else
+man_MANS = bar.2
+endif
+
+.PHONY: test1 test2
+test1:
+       test -f $(mandir)/man1/foo.1
+       test ! -f $(mandir)/man2/bar.2
+test2:
+       test ! -f $(mandir)/man1/foo.1
+       test -f $(mandir)/man2/bar.2
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir dir1
+cd dir1
+../configure FOO=true --prefix="`pwd`/_inst"
+sed -n '/man_MANS/p' Makefile # useful for debugging
+: > foo.1
+$MAKE install
+$MAKE test1
+
+cd ..
+mkdir dir2
+cd dir2
+../configure FOO=false --prefix="`pwd`/_inst"
+sed -n '/man_MANS/p' Makefile # useful for debugging
+: > bar.2
+$MAKE install
+$MAKE test2
+
+:
-- 
1.7.1


reply via email to

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