automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.


From: Stefano Lattarini
Subject: Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.
Date: Fri, 18 Jun 2010 13:07:38 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

At Thursday 17 June 2010, Ralf Wildenhues wrote:
> Hi Stefano,
> 
> * Stefano Lattarini wrote on Sat, Jun 12, 2010 at 11:31:57PM CEST:
> > New tests on obsoleted usages of automake/autoconf macros (as
> > AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT).
> 
> I have some detail questions about these tests, below.
> Thanks for working on them!
> 
> Cheers,
> Ralf
> 
> > --- /dev/null
> > +++ b/tests/backcompat2.test
> >
> > @@ -0,0 +1,69 @@
> > +# A trick to make the test run muuuch faster, by avoiding repeated
> > +# runs of aclocal (one order of magnitude improvement in speed!).
> > +echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' >configure.in
> > +$ACLOCAL
> 
> Hmm, does that mean this test completely relies on caching?
It *should* mean that the test relies on each autoconf call requiring an
aclocal.m4 that defines just AM_INIT_AUTOMAKE and the macros it requires,
and nothing more.  And this aclocal.m4 is created by the first $ACLOCAL
run.

Just to be sure, I amended the script to remove the autom4te.* stuff after
the call to $ACLOCAL (and only then).

> You probably need a $sleep or "rm -rf autom4te.cache" before
> each of the following edits to configure.in, to avoid autotools
> operating on old cached transformations of the file.
But then we would need to do that in each test where we modify and reuse
'configure.in' (see e.g. acloca10.test, pr401.test, nodef.test, etc..).  Right?

> Am I overlooking something here?
I'd like to ask you the same question :-)
Can you explain in few words how autotools caching works exactly?
I'm starting to feel rather confused...

> > +
> > +cat > Makefile.am <<'END'
> > +got: Makefile
> > +   @{ \
> 
> Please put ':;' before '{', see `info Autoconf "Limitations of
> Builtins"' on {...}.
OK.

> > +     echo 'PACKAGE = $(PACKAGE)'; \
> > +     echo 'VERSION = $(VERSION)'; \
> > +     echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
> > +     echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
> > +     echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
> > +     echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
> > +     echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
> > +     echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
> 
> git Automake still aims to build with Autoconf 2.62, which didn't
> provide PACKAGE_URL yet,
Oops.
> that is only 2.64+.  Does this test work with older Autoconf
> versions?
Nope.  But the amended test works with autoconf 2.62 and autom4te 2.62
(tested).

> > --- /dev/null
> > +++ b/tests/backcompat6.test
> >
> > +# Anyone doing something like this in a real-life package probably
> > +# deserves to be killed.
> 
> I'm not yet sure whether I really want this particular test.
Well, it's up to you to decide :-)
It depends on which degree of backward-compatibility and/or users' bad
practices you are willing to support (the 'configure.in' in this test is
admittedly a bit extreme in those respects).
For the moment, I've watered down the test a bit.  If you still think it's not
worth having, simply remove it.  But IMHO we should have at least a test
having in 'configure.in' something like:
  PACKAGE=foo
  VERSION=bar
  AM_INIT_AUTOMAKE($PACKAGE, $VERSION)

> > diff --git a/tests/init.test b/tests/init.test
> > index 38ec681..61a5b63 100755
> > --- a/tests/init.test
> > +++ b/tests/init.test
> > [CUT]
> > -cat >configure.in <<END
> > -AC_INIT
> > -AM_INIT_AUTOMAKE
> > +for ac_init_args in '' '([x])'; do
> > +  for am_init_args in '' '([1.10])'; do
> > +    rm -rf aclocal.m4 autom4ate*.cache
> 
> Typo autom4ate.
Oops. Fixed.

Regards,
      Stefano
From 77b0461a42045a68d316328cc5a6963c0f1aa796 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 18 Jun 2010 12:56:47 +0200
Subject: [PATCH] New tests on obsoleted usages of automake/autoconf macros.

* tests/backcompat.test: New test script.
* tests/backcompat2.test: Likewise.
* tests/backcompat3.test: Likewise.
* tests/backcompat4.test: Likewise.
* tests/backcompat5.test: Likewise.
* tests/backcompat6.test: Likewise.
* tests/init.test: Extended and improved, esp. by trying more
combinations of calls to AC_INIT and AM_INIT_AUTOMAKE with few
arguments.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog              |   15 +++++
 tests/Makefile.am      |    6 ++
 tests/Makefile.in      |   19 ++++--
 tests/backcompat.test  |   66 ++++++++++++++++++++
 tests/backcompat2.test |   69 +++++++++++++++++++++
 tests/backcompat3.test |  154 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/backcompat4.test |   62 +++++++++++++++++++
 tests/backcompat5.test |  118 ++++++++++++++++++++++++++++++++++++
 tests/backcompat6.test |  104 ++++++++++++++++++++++++++++++++
 tests/init.test        |   29 ++++++----
 10 files changed, 625 insertions(+), 17 deletions(-)
 create mode 100755 tests/backcompat.test
 create mode 100755 tests/backcompat2.test
 create mode 100755 tests/backcompat3.test
 create mode 100755 tests/backcompat4.test
 create mode 100755 tests/backcompat5.test
 create mode 100755 tests/backcompat6.test

diff --git a/ChangeLog b/ChangeLog
index c4e69a5..8c03021 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-06-18  Stefano Lattarini  <address@hidden>
+
+       New tests on obsoleted usages of automake/autoconf macros (as
+       AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT).
+       * tests/backcompat.test: New test script.
+       * tests/backcompat2.test: Likewise.
+       * tests/backcompat3.test: Likewise.
+       * tests/backcompat4.test: Likewise.
+       * tests/backcompat5.test: Likewise.
+       * tests/backcompat6.test: Likewise.
+       * tests/init.test: Extended and improved, esp. by trying more
+       combinations of calls to AC_INIT and AM_INIT_AUTOMAKE with few
+       arguments.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-06-12  Ralf Wildenhues  <address@hidden>
 
        Remove a couple of unneeded conditionals from tests.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7875fc5..f5f06b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -118,6 +118,12 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+backcompat.test \
+backcompat2.test \
+backcompat3.test \
+backcompat4.test \
+backcompat5.test \
+backcompat6.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 07f27ed..905b12e 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -257,12 +257,12 @@ cond17.test                                       \
 gcj6.test                                      \
 txinfo5.test
 
-parallel_tests = check-p.test check10-p.test check11-p.test \
-       check2-p.test check3-p.test check4-p.test check5-p.test \
-       check6-p.test check7-p.test check8-p.test check9-p.test \
-       color-p.test color2-p.test comment9-p.test dejagnu-p.test \
-       exeext4-p.test maken3-p.test maken4-p.test pr401-p.test \
-       pr401b-p.test pr401c-p.test
+parallel_tests = backcompat5-p.test check-p.test check10-p.test \
+       check11-p.test check2-p.test check3-p.test check4-p.test \
+       check5-p.test check6-p.test check7-p.test check8-p.test \
+       check9-p.test color-p.test color2-p.test comment9-p.test \
+       dejagnu-p.test exeext4-p.test maken3-p.test maken4-p.test \
+       pr401-p.test pr401b-p.test pr401c-p.test
 MAINTAINERCLEANFILES = $(parallel_tests)
 TESTS = \
 aclibobj.test \
@@ -331,6 +331,12 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+backcompat.test \
+backcompat2.test \
+backcompat3.test \
+backcompat4.test \
+backcompat5.test \
+backcompat6.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
@@ -1364,6 +1370,7 @@ uninstall-am:
        maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
        pdf-am ps ps-am recheck recheck-html uninstall uninstall-am
 
+backcompat5-p.log: backcompat5.test
 check-p.log: check.test
 check10-p.log: check10.test
 check11-p.log: check11.test
diff --git a/tests/backcompat.test b/tests/backcompat.test
new file mode 100755
index 0000000..770e8d8
--- /dev/null
+++ b/tests/backcompat.test
@@ -0,0 +1,66 @@
+#! /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 usage of AM_INIT_AUTOMAKE with two ot three arguments, for
+# backward-compatibility.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am <<'END'
+.PHONY: test display
+
+## Might be useful for debugging.
+display:
+       ## The following should be substituted by AM_INIT_AUTOMAKE.
+       @echo PACKAGE = $(PACKAGE)
+       @echo VERSION = $(VERSION)
+       ## The following should not be substituted, as we used the
+       ## old form of AC_INIT.
+       @echo PACKAGE_NAME = $(PACKAGE_NAME)
+       @echo PACKAGE_VERSION = $(PACKAGE_VERSION)
+       @echo PACKAGE_TARNAME = $(PACKAGE_TARNAME)
+       @echo PACKAGE_STRING = $(PACKAGE_STRING)
+
+test: display
+       test x'$(PACKAGE)' = x'FooBar'
+       test x'$(VERSION)' = x'0.7.1'
+       test -z '$(PACKAGE_NAME)'
+       test -z '$(PACKAGE_VERSION)'
+       test -z '$(PACKAGE_TARNAME)'
+       test -z '$(PACKAGE_STRING)'
+END
+
+for ac_init in 'AC_INIT' 'AC_INIT([Makefile.am])'; do
+  for am_extra_args in '' ', []' ', [:]' ', [false]'; do
+    rm -rf autom4te*.cache config* Makefile.in Makefile
+    cat > configure.in <<END
+$ac_init
+AM_INIT_AUTOMAKE([FooBar], [0.7.1]$am_extra_args)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+    cat configure.in # might be useful for debugging
+    $ACLOCAL
+    $AUTOCONF
+    $AUTOMAKE
+    ./configure
+    $MAKE test
+  done
+done
+
+:
diff --git a/tests/backcompat2.test b/tests/backcompat2.test
new file mode 100755
index 0000000..833aa99
--- /dev/null
+++ b/tests/backcompat2.test
@@ -0,0 +1,69 @@
+#! /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/>.
+
+# Backward-compatibility test: check that AM_INIT_AUTOMAKE with two or
+# three arguments does AC_DEFINE the symbols PACKAGE and VERSION iff the
+# third argument is empty or non-existent.
+
+. ./defs || Exit 1
+
+set -e
+
+# A trick to make the test run muuuch faster, by avoiding repeated
+# runs of aclocal (one order of magnitude improvement in speed!).
+echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' > configure.in
+$ACLOCAL
+rm -rf configure.in autom4te.*
+
+cat > config.h.in <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+for am_arg3 in ':' 'false' '#' ' '; do
+  cat > configure.in <<END
+AC_INIT
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
+AC_OUTPUT
+END
+  cat configure.in # might be useful for debugging
+  $AUTOCONF
+  ./configure
+  test -f config.h # sanity check
+  cat config.h # might be useful for debugging
+  # The non-empty third argument should prevent PACKAGE and VERSION
+  # from being AC_DEFINE'd.
+  $EGREP 'pkg(name|version)' config.h && Exit 1
+done
+
+for am_extra_args in '' ',' ', []'; do
+  cat > configure.in <<END
+AC_INIT
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
+AC_OUTPUT
+END
+  cat configure.in # might be useful for debugging
+  $AUTOCONF
+  ./configure
+  test -f config.h # sanity check
+  cat config.h # might be useful for debugging
+  grep '^ *# *define  *PACKAGE  *"pkgname" *$' config.h
+  grep '^ *# *define  *VERSION  *"pkgversion" *$' config.h
+done
+
+:
diff --git a/tests/backcompat3.test b/tests/backcompat3.test
new file mode 100755
index 0000000..9f379ae
--- /dev/null
+++ b/tests/backcompat3.test
@@ -0,0 +1,154 @@
+#! /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/>.
+
+# Backward-compatibility test: check what happens when AC_INIT and
+# AM_INIT_AUTOMAKE are both given two or more arguments.
+
+. ./defs || Exit 1
+
+set -e
+
+empty=''
+
+cat > Makefile.am <<'END'
+## See "Limitations of Builtins" on {...} in the Autoconf manual
+## to understand why we need the leading `:;' in the rules here.
+got: Makefile
+       @:; { \
+         echo 'PACKAGE = $(PACKAGE)'; \
+         echo 'VERSION = $(VERSION)'; \
+         echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
+         echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
+         echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
+         echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
+         echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
+         echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
+       } >$@
+END
+
+
+### Run 1 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 2 ###
+
+cat > configure.in <<'END'
+dnl#  `AC_INIT' in Autoconf <= 2.63 doesn't have an URL argument.
+dnl#  Luckily, `AC_AUTOCONF_VERSION' and `m4_version_prereq' are
+dnl#  both present in autoconf 2.62, which we require; so that we
+dnl#  can at least use the following workaround.
+m4_version_prereq([2.64],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
+             [ac_url])],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname])
+     AC_SUBST([PACKAGE_URL], [ac_url])])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_tarname
+PACKAGE_BUGREPORT = ac_bugreport
+PACKAGE_URL = ac_url
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 3 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+$FGREP am_foo_quux Makefile.in Makefile configure config.status && Exit 1
+
+
+### Done ###
+
+:
diff --git a/tests/backcompat4.test b/tests/backcompat4.test
new file mode 100755
index 0000000..b678ca0
--- /dev/null
+++ b/tests/backcompat4.test
@@ -0,0 +1,62 @@
+#! /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/>.
+
+# Backward-compatibility: AC_OUTPUT with arguments.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+: > Makefile.am
+: > zardoz
+: > foo1.in
+: > foo2.in
+: > foo3.in
+: > sub/bar.in
+
+ls -l
+
+for args in \
+  'foo:foo1.in' \
+  'foo:zardoz' \
+  'foo:sub/bar.in' \
+  'foo:foo1.in:foo2.in' \
+  'foo:zardoz:zardoz' \
+  'foo:foo1.in:foo2.in:foo3.in' \
+  'foo:foo1.in:foo2.in:sub/bar.in:foo3.in' \
+; do
+  cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([$args])
+AC_OUTPUT
+END
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.acf
+  cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([$args])
+END
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.aco
+  diff Makefile.acf Makefile.aco
+done
+
+:
diff --git a/tests/backcompat5.test b/tests/backcompat5.test
new file mode 100755
index 0000000..9b74044
--- /dev/null
+++ b/tests/backcompat5.test
@@ -0,0 +1,118 @@
+#! /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/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as tame stress-testing for Automke.
+
+. ./defs || Exit 1
+
+set -e
+
+# Yuck!
+cat > configure.in <<'END'
+dnl. Everything here is *deliberately* underquoted!
+AC_INIT(src/foo.input)
+AM_INIT_AUTOMAKE(foo, 1.0)
+AC_CONFIG_FILES(Makefile:mkfile.in)
+AC_OUTPUT(hacky/Makefile src/Makefile data/Makefile tests/Makefile)
+END
+
+distdir=foo-1.0
+
+cat > mkfile.am <<'END'
+SUBDIRS = src data tests hacky
+installcheck-local:
+       grep DataDataData $(DESTDIR)$(prefix)/data/$(PACKAGE)-$(VERSION)/bar
+END
+
+mkdir hacky src tests data
+
+echo 'This is a dummy package' > README
+
+cat > src/foo.input <<'END'
+#!sh
+echo Zardoz
+END
+
+cat > tests/a.test <<'END'
+#!/bin/sh
+"$srcdir/../src/foo" | grep Zardoz
+END
+chmod a+x tests/a.test
+
+cat > data/bar <<'END'
+line1
+line2
+line3
+END
+
+cat >hacky/Makefile.am <<'END'
+dist-hook:
+       find $(top_distdir) -print ## useful for debugging
+       chmod a+rx $(top_distdir)/tests/*.test
+END
+
+cat > src/Makefile.am <<'END'
+dist_bin_SCRIPTS = foo
+foo: foo.input
+       sed '1s,^#!.*$$,#!/bin/sh,' $(srcdir)/foo.input >$@
+       chmod a+x $@
+EXTRA_DIST = foo.input
+DISTCLEANFILES = foo
+END
+
+cat > data/Makefile.am <<'END'
+nodist_data_DATA = bar
+datadir = $(prefix)/data/$(PACKAGE)-$(VERSION)
+bar:
+       echo DataDataData >$@
+distclean-local:
+       rm -f bar
+END
+
+cat > tests/Makefile.am <<'END'
+TESTS = a.test
+EXTRA_DIST = $(TESTS)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+ls -l . hacky src data tests
+test ! -f mkfile
+$MAKE
+$MAKE distdir
+test ! -f $distdir/Makefile.in
+test ! -f $distdir/data/bar
+test -f $distdir/src/foo
+diff README $distdir/README
+diff mkfile.in $distdir/mkfile.in
+diff tests/a.test $distdir/tests/a.test
+diff src/foo.input $distdir/src/foo.input
+
+$MAKE check
+$MAKE distcheck
+
+test -f $distdir.tar.gz
+
+chmod a-x tests/a.test
+# dist-hook should take care of making test files executables
+$MAKE distcheck
+
+:
diff --git a/tests/backcompat6.test b/tests/backcompat6.test
new file mode 100755
index 0000000..4a37828
--- /dev/null
+++ b/tests/backcompat6.test
@@ -0,0 +1,104 @@
+#! /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/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as tame stress-testing for Automke.
+
+. ./defs || Exit 1
+
+set -e
+
+# Anyone doing something like this in a real-life package probably
+# deserves to be killed.
+cat > configure.in <<'END'
+dnl. Everything here is *deliberately* underquoted!
+AC_INIT(quux.c)
+PACKAGE=nonesuch-zardoz
+VERSION=nonesuch-0.1
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AC_SUBST(one,1)
+two=2
+AC_SUBST(two, $two)
+three=3
+AC_SUBST(three)
+AC_PROG_CC
+AC_CONFIG_HEADERS(config.h:config.hin)
+AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
+END
+
+echo @one@ > foo1.in
+echo @two@ > foo2.in
+echo @three@ > foo3.in
+
+cat >config.hin <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+cat >> Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = quux.c
+DISTCLEANFILES = *.tmp
+check-local:
+       rm -f exp got
+       echo 'PACKAGE = nonesuch-zardoz' > exp.tmp
+       echo 'VERSION = nonesuch-0.1' >> exp.tmp
+       echo 'PACKAGE = $(PACKAGE)' > got1.tmp
+       echo 'VERSION = $(VERSION)' >> got1.tmp
+       ./foo > got2.tmp
+       cat exp.tmp
+       cat got1.tmp
+       cat got2.tmp
+       diff exp.tmp got1.tmp
+       diff exp.tmp got2.tmp
+END
+
+cat > quux.c <<'END'
+#include <config.h>
+#include <stdio.h>
+int main (void)
+{
+  printf("PACKAGE = %s\nVERSION = %s\n", PACKAGE, VERSION);
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+cat >foo.exp <<'END'
+1
+2
+3
+END
+
+diff foo.exp foo.got
+
+$MAKE
+$MAKE check
+
+distdir=nonesuch-zardoz-nonesuch-0.1
+$MAKE distdir
+test -f $distdir/quux.c
+test ! -f $distdir/foo.got
+
+$MAKE distcheck
+
+:
diff --git a/tests/init.test b/tests/init.test
index 38ec681..895bad6 100755
--- a/tests/init.test
+++ b/tests/init.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -14,20 +14,27 @@
 # 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 we give a sensible error message when neither AC_INIT nor
-# AM_INIT_AUTOMAKE are given arguments.
+# Make sure we give a sensible error message when AC_INIT and
+# AM_INIT_AUTOMAKE are both given less than two arguments.
 
 . ./defs || Exit 1
 
 set -e
 
-cat >configure.in <<END
-AC_INIT
-AM_INIT_AUTOMAKE
+for ac_init_args in '' '([x])'; do
+  for am_init_args in '' '([1.10])'; do
+    rm -rf aclocal.m4 autom4te*.cache
+    cat >configure.in <<END
+AC_INIT$ac_init_args
+AM_INIT_AUTOMAKE$am_init_args
 END
+    cat configure.in # might be useful for debugging
+    # The error message should mention AC_INIT, not AC_PACKAGE_VERSION.
+    ($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
+    cat stderr >&2
+    $FGREP AC_PACKAGE_VERSION stderr && Exit 1
+    grep 'configure\.in:.* AC_INIT .*arguments' stderr
+  done
+done
 
-# The error message should mension AC_INIT, not AC_PACKAGE_VERSION.
-($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep AC_PACKAGE_VERSION stderr && Exit 1
-grep AC_INIT stderr
+:
-- 
1.6.5


reply via email to

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