automake-patches
[Top][All Lists]
Advanced

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

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


From: Stefano Lattarini
Subject: [PATCH] New tests on obsoleted usages of automake/autoconf macros.
Date: Sat, 12 Jun 2010 23:31:57 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

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.
From 6d32cd86d163831ef0d9b915b4906afb6e1b4794 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 12 Jun 2010 22:29:59 +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 |  144 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/backcompat4.test |   62 +++++++++++++++++++++
 tests/backcompat5.test |  118 +++++++++++++++++++++++++++++++++++++++
 tests/backcompat6.test |  104 ++++++++++++++++++++++++++++++++++
 tests/init.test        |   29 ++++++----
 10 files changed, 615 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..320fbd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-06-12  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..5ac1010
--- /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 -f configure.in
+
+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..0c46b30
--- /dev/null
+++ b/tests/backcompat3.test
@@ -0,0 +1,144 @@
+#! /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'
+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
+AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname], [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..d724fdd
--- /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(${me-xxx}.c) dnl. Hacky!
+PACKAGE=nonesuch-${me-xxx} dnl. Hacky!
+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 = $me.c
+DISTCLEANFILES = *.tmp
+check-local:
+       rm -f exp got
+       echo 'PACKAGE = nonesuch-$me' > 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 > $me.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
+
+me=$me ./configure  # Hacky!
+
+cat >foo.exp <<'END'
+1
+2
+3
+END
+
+diff foo.exp foo.got
+
+$MAKE
+$MAKE check
+
+distdir=nonesuch-$me-nonesuch-0.1
+$MAKE distdir
+test -f $distdir/$me.c
+test ! -f $distdir/foo.got
+
+me=$me $MAKE distcheck  # Hacky!
+
+:
diff --git a/tests/init.test b/tests/init.test
index 38ec681..61a5b63 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 autom4ate*.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]