automake-patches
[Top][All Lists]
Advanced

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

[PATCH] {maint} tests: add checks on automatically-distributed files


From: Stefano Lattarini
Subject: [PATCH] {maint} tests: add checks on automatically-distributed files
Date: Tue, 11 Jan 2011 00:05:20 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

This patch adds some new tests related to automake bug#7819.
Reference:
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7819>

They all pass already; but it will be possible to simplify the tests
`autodist.test' and `autodist-subdir.test' once the bug is fixed.

OK for maint?  I will wait the customary 72 hours before pushing.

Regards,
  Stefano

-*-*-

tests: add checks on automatically-distributed files

Related to automake bug#7819.

* tests/autodist.test: New test.
* tests/autodist-subdir.test: Likewise.
* tests/autodist-acconfig.test: Likewise.
* tests/autodist-acconfig-no-subdir.test: Likewise.
* tests/autodist-aclocal-m4.test: Likewise.
* tests/autodist-config-headers.test: Likewise.
* tests/autodist-configure-no-subdir.test: Likewise.
* tests/autodist-stamp-vti.test: Likewise.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                               |   14 +++
 tests/Makefile.am                       |    8 ++
 tests/Makefile.in                       |    8 ++
 tests/autodist-acconfig-no-subdir.test  |   58 ++++++++++++
 tests/autodist-acconfig.test            |   46 ++++++++++
 tests/autodist-aclocal-m4.test          |   52 +++++++++++
 tests/autodist-config-headers.test      |   61 +++++++++++++
 tests/autodist-configure-no-subdir.test |   72 +++++++++++++++
 tests/autodist-stamp-vti.test           |   60 ++++++++++++
 tests/autodist-subdir.test              |  151 +++++++++++++++++++++++++++++++
 tests/autodist.test                     |  145 +++++++++++++++++++++++++++++
 11 files changed, 675 insertions(+), 0 deletions(-)
 create mode 100755 tests/autodist-acconfig-no-subdir.test
 create mode 100755 tests/autodist-acconfig.test
 create mode 100755 tests/autodist-aclocal-m4.test
 create mode 100755 tests/autodist-config-headers.test
 create mode 100755 tests/autodist-configure-no-subdir.test
 create mode 100755 tests/autodist-stamp-vti.test
 create mode 100755 tests/autodist-subdir.test
 create mode 100755 tests/autodist.test
From 0c2fd9c663b1a54aaddd0be2c7655bb21528a8f6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 10 Jan 2011 23:56:43 +0100
Subject: [PATCH] tests: add checks on automatically-distributed files

Related to automake bug#7819.

* tests/autodist.test: New test.
* tests/autodist-subdir.test: Likewise.
* tests/autodist-acconfig.test: Likewise.
* tests/autodist-acconfig-no-subdir.test: Likewise.
* tests/autodist-aclocal-m4.test: Likewise.
* tests/autodist-config-headers.test: Likewise.
* tests/autodist-configure-no-subdir.test: Likewise.
* tests/autodist-stamp-vti.test: Likewise.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                               |   14 +++
 tests/Makefile.am                       |    8 ++
 tests/Makefile.in                       |    8 ++
 tests/autodist-acconfig-no-subdir.test  |   58 ++++++++++++
 tests/autodist-acconfig.test            |   46 ++++++++++
 tests/autodist-aclocal-m4.test          |   52 +++++++++++
 tests/autodist-config-headers.test      |   61 +++++++++++++
 tests/autodist-configure-no-subdir.test |   72 +++++++++++++++
 tests/autodist-stamp-vti.test           |   60 ++++++++++++
 tests/autodist-subdir.test              |  151 +++++++++++++++++++++++++++++++
 tests/autodist.test                     |  145 +++++++++++++++++++++++++++++
 11 files changed, 675 insertions(+), 0 deletions(-)
 create mode 100755 tests/autodist-acconfig-no-subdir.test
 create mode 100755 tests/autodist-acconfig.test
 create mode 100755 tests/autodist-aclocal-m4.test
 create mode 100755 tests/autodist-config-headers.test
 create mode 100755 tests/autodist-configure-no-subdir.test
 create mode 100755 tests/autodist-stamp-vti.test
 create mode 100755 tests/autodist-subdir.test
 create mode 100755 tests/autodist.test

diff --git a/ChangeLog b/ChangeLog
index b59819f..ca2c481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-10   Stefano Lattarini  <address@hidden>
+
+       tests: add checks on automatically-distributed files
+       Related to automake bug#7819.
+       * tests/autodist.test: New test.
+       * tests/autodist-subdir.test: Likewise.
+       * tests/autodist-acconfig.test: Likewise.
+       * tests/autodist-acconfig-no-subdir.test: Likewise.
+       * tests/autodist-aclocal-m4.test: Likewise.
+       * tests/autodist-config-headers.test: Likewise.
+       * tests/autodist-configure-no-subdir.test: Likewise.
+       * tests/autodist-stamp-vti.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-01-09   Stefano Lattarini  <address@hidden>
 
        cosmetics: remove trailing whitespaces
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8842be3..fe93ac2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -94,6 +94,14 @@ ar2.test \
 asm.test \
 asm2.test \
 asm3.test \
+autodist.test \
+autodist-subdir.test \
+autodist-acconfig.test \
+autodist-acconfig-no-subdir.test \
+autodist-aclocal-m4.test \
+autodist-config-headers.test \
+autodist-configure-no-subdir.test \
+autodist-stamp-vti.test \
 autohdr.test \
 autohdr2.test \
 autohdr3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3bc4415..5254252 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -361,6 +361,14 @@ ar2.test \
 asm.test \
 asm2.test \
 asm3.test \
+autodist.test \
+autodist-subdir.test \
+autodist-acconfig.test \
+autodist-acconfig-no-subdir.test \
+autodist-aclocal-m4.test \
+autodist-config-headers.test \
+autodist-configure-no-subdir.test \
+autodist-stamp-vti.test \
 autohdr.test \
 autohdr2.test \
 autohdr3.test \
diff --git a/tests/autodist-acconfig-no-subdir.test 
b/tests/autodist-acconfig-no-subdir.test
new file mode 100755
index 0000000..e6bd5a9
--- /dev/null
+++ b/tests/autodist-acconfig-no-subdir.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that `acconfig.h' is *not* automatically distributed when
+# placed in a subdirectory.
+# Related to automake bug#7819.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<END
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+sub/acconfig.h:
+       echo target $@ should not be built >&2; exit 1
+check-local: distdir
+       ls -l $(distdir)/sub
+       test ! -f $(distdir)/sub/acconfig.h
+END
+
+mkdir sub
+
+cat > sub/Makefile.am <<'END'
+acconfig.h:
+       echo target $@ should not be built >&2; exit 1
+check-local:
+       echo $(DISTFILES) | grep 'acconfig\.h' && exit 1; :
+       echo $(DIST_COMMON) | grep 'acconfig\.h' && exit 1; :
+END
+
+: > sub/acconfig.h
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE check
+
+:
diff --git a/tests/autodist-acconfig.test b/tests/autodist-acconfig.test
new file mode 100755
index 0000000..49ab2f0
--- /dev/null
+++ b/tests/autodist-acconfig.test
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that `acconfig.h' is automatically distributed if it exists
+# (at automake runtime).
+# Related to automake bug#7819.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]acconfig\.h '
+       test -f $(distdir)/acconfig.h
+END
+
+: > acconfig.h
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/autodist-aclocal-m4.test b/tests/autodist-aclocal-m4.test
new file mode 100755
index 0000000..2fdf16b
--- /dev/null
+++ b/tests/autodist-aclocal-m4.test
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that `aclocal.m4' is not automatically distributed if nor
+# required to build `configure'.
+# Related to automake bug#7819.
+
+. ./defs || Exit 1
+
+set -e
+
+{ echo 'm4_include([defs.m4])'
+  cat configure.in
+  echo 'AC_OUTPUT'
+} > t
+mv -f t configure.in
+
+cat > Makefile.am <<'END'
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       test ! -f $(distdir)/aclocal.m4
+       echo $(DISTFILES) | grep 'aclocal\.m4' && exit 1; :
+       echo $(DIST_COMMON) | grep 'aclocal\.m4' && exit 1; :
+check-local: test
+END
+
+: > defs.m4
+$ACLOCAL
+mv -f aclocal.m4 defs.m4
+
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE test
+$MAKE distcheck
+
+:
diff --git a/tests/autodist-config-headers.test 
b/tests/autodist-config-headers.test
new file mode 100755
index 0000000..e70150a
--- /dev/null
+++ b/tests/autodist-config-headers.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that config.h.bot and config.h.top are automatically
+# distributed if the AC_CONFIG_HADERS macro is used, and they
+# exist at automake runtime.
+# Related to automake bug#7819.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<END
+AC_CONFIG_HEADERS([config.h sub/config.h cfg2.h:conf2.hin])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: test
+test: distdir
+       ls -l $(distdir) $(distdir)/sub
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]config\.h\.bot '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]config\.h\.top '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]cfg2\.h\.bot '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]cfg2\.h\.top '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]sub/config\.h\.bot '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]sub/config\.h\.top '
+       test -f $(distdir)/config.h.bot
+       test -f $(distdir)/config.h.top
+       test -f $(distdir)/cfg2.h.bot
+       test -f $(distdir)/cfg2.h.top
+       test -f $(distdir)/sub/config.h.bot
+       test -f $(distdir)/sub/config.h.top
+END
+
+mkdir sub
+touch config.h.in config.h.top config.h.bot \
+      conf2.hin cfg2.h.top cfg2.h.bot \
+      sub/config.h.in sub/config.h.top sub/config.h.bot
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/autodist-configure-no-subdir.test 
b/tests/autodist-configure-no-subdir.test
new file mode 100755
index 0000000..db640c4
--- /dev/null
+++ b/tests/autodist-configure-no-subdir.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that `configure', `configure.ac' and `configure.in' are *not*
+# automatically distributed when placed in a subdirectory.
+# Related to automake bug#7819.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<END
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+dontbuild = echo target $@ should not be built >&2; exit 1
+sub/configure:
+       $(dontbuild)
+sub/configure.ac:
+       $(dontbuild)
+sub/configure.in:
+       $(dontbuild)
+check-local: distdir
+       ls -l $(distdir)/sub
+       test ! -f $(distdir)/sub/configure
+       test ! -f $(distdir)/sub/configure.in
+       test ! -f $(distdir)/sub/configure.ac
+END
+
+mkdir sub
+
+cat > sub/Makefile.am <<'END'
+dontbuild = echo target $@ should not be built >&2; exit 1
+configure:
+       $(dontbuild)
+configure.ac:
+       $(dontbuild)
+configure.in:
+       $(dontbuild)
+check-local:
+       echo $(DISTFILES) | grep 'configure' && exit 1; :
+       echo $(DIST_COMMON) | grep 'configure' && exit 1; :
+END
+
+: > sub/configure.ac
+: > sub/configure.in
+: > sub/configure
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE check
+
+:
diff --git a/tests/autodist-stamp-vti.test b/tests/autodist-stamp-vti.test
new file mode 100755
index 0000000..4f37e14
--- /dev/null
+++ b/tests/autodist-stamp-vti.test
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that `stamp-vti' is automatically distributed when info_TEXINFOS
+# and version.texi are involved.
+# Related to automake bug#7819.
+
+required=makeinfo
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = foo.texi
+.PHONY: test
+test: all distdir
+       ls -l $(distdir)
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]stamp-vti '
+       test -f $(distdir)/stamp-vti
+END
+
+cat > foo.texi << 'END'
+\input texinfo
address@hidden foo.info
address@hidden Zardoz
address@hidden Top
address@hidden version.texi
+bar baz quux
address@hidden
+END
+
+# Required when using Texinfo.
+: > texinfo.tex
+cp "$testsrcdir/../lib/mdate-sh" .
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/autodist-subdir.test b/tests/autodist-subdir.test
new file mode 100755
index 0000000..f2dcde6
--- /dev/null
+++ b/tests/autodist-subdir.test
@@ -0,0 +1,151 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that automake really distributes automatically all the files
+# it is advertised to, even when in subdirectories.
+#
+# This behavior might be suboptimal, but it has been in place for quite
+# a long time, and it would be risky to change it now.  See also the
+# discussion of automake bug#7819:
+#  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7819>
+#
+# Keep this test in sync with sister test `autodist.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+
+# The automake manual tells that the list of automatically-distributed
+# files should be given by `automake --help'.
+list=`$AUTOMAKE --help \
+        | sed -n '/^Files .*automatically distributed.*if found/,/^ *$/p' \
+        | sed 1d`
+list=`for f in $list; do
+        case $f in 
+          configure|configure.in|configure.ac)
+            # The files configure.ac, configure.in and configure are
+            # special-cased enough that we want to meddle with them.
+            ;;
+          aclocal.m4)
+            # This file should be distributed only when it is a real
+            # deprendency for configure.  Anyway, not a check to be
+            # performed in this test.
+            ;;
+          acconfig.h)
+            # Works only when it really exists, not when it is a
+            # target in Makefile.am; see also automake bug#7819.
+            ;;
+          stamp-vti)
+            # Works only when using info_TEXINFOS and version.texi;
+            # see also automake bug#7819.
+            ;;
+          config.h.bot|config.h.top)
+            # Works only when the AC_CONFIG_HADERS macro is used;
+            # see also automake bug#7819.
+            ;;
+          *)
+            echo $f
+            ;;
+        esac
+      done`
+# Normalize whitespaces, just in case.
+list=`echo $list`
+
+test -n "$list" || Exit 1
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+check-local:
+## For debugging.
+       @echo DIST_COMMON:
+       @for f in $(DIST_COMMON); do echo "  $$f"; done
+       @echo DISTDIR:
+       @ls -l $(distdir) | sed 's/^/  /'
+## Now the checks.
+       @for f in $(autodist_list); do \
+         echo "file: sub/$$f"; \
+         test -f $(distdir)/sub/$$f \
+           || { echo $$f: distdir fail >&2; exit 1; }; \
+       done
+END
+
+mkdir sub
+
+cat > sub/Makefile.am <<'END'
+include distfiles.am
+check-local:
+## For debugging.
+       @echo DIST_COMMON:
+       @for f in $(DIST_COMMON); do echo "  $$f"; done
+       @echo DISTDIR:
+       @ls -l $(distdir) | sed 's/^/  /'
+## Now the checks.
+       @for f in $(autodist_list); do \
+         echo "file: $$f"; \
+         ## Some filenames might contains dots, which are metacharacters
+         ## for grep.  But this won't cause spurious failures, and the
+         ## evantuality of a "spurious success" caused by them is such a
+         ## low-probability event that it's not worth worrying about.
+         echo ' ' $(DIST_COMMON) ' ' | grep "[ /]$$f " >/dev/null \
+           || { echo $$f: distcom fail >&2; exit 1; }; \
+       done
+END
+
+: First try listing the automatically-distributed files in proper
+: targets in Makefile.am
+
+echo "MAINTAINERCLEANFILES = $list" > sub/distfiles.am
+for f in $list; do echo "$f:; touch $f"; done >> sub/distfiles.am
+
+cat sub/distfiles.am # For debugging.
+
+$AUTOMAKE -a
+
+./configure
+
+$MAKE distdir
+autodist_list="$list" $MAKE check
+
+$MAKE maintainer-clean
+test ! -f sub/README    # Sanity check.
+rm -rf $me-1.0          # Remove $(distdir).
+
+: Now try creating the automatically-distributed files before
+: runnng automake.
+
+: > sub/distfiles.am
+for f in $list; do
+  echo dummy > sub/$f
+done
+
+ls -l # For debugging.
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distdir
+autodist_list="$list" $MAKE check
+
+:
diff --git a/tests/autodist.test b/tests/autodist.test
new file mode 100755
index 0000000..e65ee6a
--- /dev/null
+++ b/tests/autodist.test
@@ -0,0 +1,145 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check that automake really distributes automatically all the files
+# it is advertised to.
+# Related to automake bug#7819.
+# Keep this test in sync with sister test `autodist-subdir.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+# Ensure we are run from the right directory.
+# (The last thing we want is to delete some random user files.)
+test -f ../defs-static
+rm -f *
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+## Will avoid useless regeneration of aclocal.m4, configure, etc.
+AM_MAINTAINER_MODE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+
+# The automake manual tells that the list of automatically-distributed
+# files should be given by `automake --help'.
+list=`$AUTOMAKE --help \
+        | sed -n '/^Files .*automatically distributed.*if found/,/^ *$/p' \
+        | sed 1d`
+list=`for f in $list; do
+        case $f in 
+          configure|configure.in|configure.ac)
+            # The files configure.ac, configure.in and configure are
+            # special-cased enough that we want to meddle with them.
+            ;;
+          aclocal.m4)
+            # This file should be distributed only when it is a real
+            # deprendency for configure.  Anyway, not a check to be
+            # performed in this test.
+            ;;
+          acconfig.h)
+            # Works only when it really exists, not when it is a
+            # target in Makefile.am; see also automake bug#7819.
+            ;;
+          stamp-vti)
+            # Works only when using info_TEXINFOS and version.texi;
+            # see also automake bug#7819.
+            ;;
+          config.h.bot|config.h.top)
+            # Works only when the AC_CONFIG_HADERS macro is used;
+            # see also automake bug#7819.
+            ;;
+          *)
+            echo $f
+            ;;
+        esac
+      done`
+# Normalize whitespaces, just in case.
+list=`echo $list`
+
+test -n "$list" || Exit 1
+
+cat > Makefile.am <<'END'
+include distfiles.am
+check-local:
+## For debugging.
+       @echo DIST_COMMON:
+       @for f in $(DIST_COMMON); do echo "  $$f"; done
+       @echo DISTDIR:
+       @ls -l $(distdir) | sed 's/^/  /'
+## Now the checks.
+       @for f in $(autodist_list); do \
+         echo "file: $$f"; \
+         test -f $(distdir)/$$f \
+           || { echo $$f: distdir fail >&2; exit 1; }; \
+         ## Some filenames might contains dots, which are metacharacters
+         ## for grep.  But this won't cause spurious failures, and the
+         ## evantuality of a "spurious success" caused by them is such a
+         ## low-probability event that it's not worth worrying about.
+         echo ' ' $(DIST_COMMON) ' ' | grep "[ /]$$f " >/dev/null \
+           || { echo $$f: distcom fail >&2; exit 1; }; \
+       done
+END
+
+: First try listing the automatically-distributed files in proper
+: targets in Makefile.am
+
+echo "MAINTAINERCLEANFILES = $list" > distfiles.am
+for f in $list; do
+  # This indirections are needed to avoid redefining automake-generated
+  # targets such as aclocal.m4.
+  echo "$f: touch-$f"
+  echo "touch-$f:; touch $f"
+done >> distfiles.am
+
+cat distfiles.am # For debugging.
+
+$AUTOMAKE -a
+
+./configure
+
+$MAKE distdir
+autodist_list="$list" $MAKE check
+
+$MAKE maintainer-clean
+test ! -f README        # Sanity check.
+rm -rf $me-1.0          # Remove $(distdir).
+
+: Now try creating the automatically-distributed files before
+: runnng automake.
+
+: > distfiles.am
+for f in $list; do
+  echo dummy > $f
+done
+
+ls -l # For debugging.
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distdir
+autodist_list="$list" $MAKE check
+
+:
-- 
1.7.2.3


reply via email to

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