Subject: bug#18286: [PATCH 1/2] tests: expose automake bug#18286 "distcheck fails to detect missing files"

From: Stefano Lattarini <[email-masked]>
Date: Tue, 23 Dec 2014 20:23:57 +0100

* t/distcheck-pr18286.sh: New test, still XFAILing.
* t/list-of-tests.mk: Add it.

Signed-off-by: Stefano Lattarini <[email-masked]>
---
 t/distcheck-pr18286.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk     |  2 ++
 2 files changed, 64 insertions(+)
 create mode 100644 t/distcheck-pr18286.sh

diff --git a/t/distcheck-pr18286.sh b/t/distcheck-pr18286.sh
new file mode 100644
index 0000000..b107735
--- /dev/null
+++ b/t/distcheck-pr18286.sh
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2014 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/>.
+
+# Ensure "make distcheck" detects all missing files, without getting
+# confused by the fact that they exists in the "original" source tree
+# from which "make distcheck" is run. See automake bug#18286.
+
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<'END'
+$(srcdir)/test_data.am: $(srcdir)/test_data.txt $(srcdir)/gen-testdata.sh
+	cd $(srcdir) && $(SHELL) gen-testdata.sh <test_data.txt >test_data.am
+
+include $(srcdir)/test_data.am
+
+check-local:
+	is $(testdata) == foo bar
+END
+
+cat > test_data.txt <<'END'
+foo
+bar
+END
+
+
+cat > gen-testdata.sh <<'END'
+#!/bin/sh
+printf 'testdata = \\\n'
+sed 's/$/ \\/'
+echo '$(empty_string)'
+END
+chmod a+x gen-testdata.sh
+
+$sleep
+./gen-testdata.sh <test_data.txt >test_data.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check
+
+run_make -e FAIL -M distcheck
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index c07eb72..ad96326 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -31,6 +31,7 @@ t/pm/Version3.pl
 XFAIL_TESTS = \
 t/all.sh \
 t/cond17.sh \
+t/distcheck-pr18286.sh \
 t/gcj6.sh \
 t/override-conditional-2.sh \
 t/override-conditional-pr13940.sh \
@@ -427,6 +428,7 @@ t/distcheck-no-prefix-or-srcdir-override.sh \
 t/distcheck-override-infodir.sh \
 t/distcheck-pr9579.sh \
 t/distcheck-pr10470.sh \
+t/distcheck-pr18286.sh \
 t/dmalloc.sh \
 t/doc-parsing-buglets-colneq-subst.sh \
 t/doc-parsing-buglets-tabs.sh \
-- 
2.1.3