summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2014-12-23 21:15:18 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2014-12-23 21:15:18 +0100
commitbd838a68d44a3adce9ae4b2c5e3e17b47eead7c1 (patch)
tree9d2bd302f9a79d42e45cd06e21787a94e6f97c75 /t
parent88ac92b2d5beaf4aee7d7bb4f3dc9a86da823550 (diff)
parent6979c8e680b68dbc2b27b4db808cb037ba6aabb7 (diff)
downloadautomake-bd838a68d44a3adce9ae4b2c5e3e17b47eead7c1.tar.gz
Merge branch 'micro' into minor
* micro: dist: fix bug#18286 "distcheck fails to detect missing files" tests: expose automake bug#18286 "distcheck fails to detect missing files" include: fix bug in handling of user-defined makefile fragments generation tests: expose bug in handling of user-defined makefile fragments generation
Diffstat (limited to 't')
-rw-r--r--t/am-include-only-one-generated-fragment.sh48
-rw-r--r--t/dejagnu-relative-srcdir.sh6
-rw-r--r--t/distcheck-pr18286.sh70
-rw-r--r--t/list-of-tests.mk2
-rw-r--r--t/subdir-ac-subst.sh14
-rw-r--r--t/subdir-am-cond.sh14
-rw-r--r--t/txinfo-builddir.sh2
7 files changed, 140 insertions, 16 deletions
diff --git a/t/am-include-only-one-generated-fragment.sh b/t/am-include-only-one-generated-fragment.sh
new file mode 100644
index 000000000..57a8aecbf
--- /dev/null
+++ b/t/am-include-only-one-generated-fragment.sh
@@ -0,0 +1,48 @@
+#! /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/>.
+
+# Check that inclusion of only one '.am' that can be regenerated via
+# a user-defined Makefile rule does not incur in spurious automake
+# warnings about "target redefinition".
+
+. test-init.sh
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+include foobar.am
+$(srcdir)/foobar.am: $(srcdir)/touch.sh
+ $(SHELL) $(srcdir)/touch.sh $(srcdir)/foobar.am
+EXTRA_DIST = touch.sh
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+include $(top_srcdir)/quux.am
+$(top_srcdir)/quux.am: $(top_srcdir)/touch.sh
+ $(SHELL) $(top_srcdir)/touch.sh $@
+END
+
+: > foobar.am
+: > quux.am
+
+$ACLOCAL
+$AUTOMAKE
+
+:
diff --git a/t/dejagnu-relative-srcdir.sh b/t/dejagnu-relative-srcdir.sh
index 79a37dd3d..34e67101e 100644
--- a/t/dejagnu-relative-srcdir.sh
+++ b/t/dejagnu-relative-srcdir.sh
@@ -43,7 +43,7 @@ END
cat > env.test/env.exp << 'END'
set env_srcdir $env(srcdir)
send_user "env_srcdir: $env_srcdir\n"
-if { [ regexp "^\.\.?$" $env_srcdir ] } {
+if { [ regexp "^\.(\./\.\.)?$" $env_srcdir ] } {
pass "test_env_src"
} else {
fail "test_env_src"
@@ -52,13 +52,13 @@ END
cat > tcl.test/tcl.exp << 'END'
send_user "tcl_srcdir: $srcdir\n"
-if { [ regexp "^\.\.?$" $srcdir ] } {
+if { [ regexp "^\.(\./\.\.)?$" $srcdir ] } {
pass "test_tcl_src"
} else {
fail "test_tcl_src"
}
send_user "tcl_orig_srcdir: $orig_srcdir\n"
-if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+if { [ regexp "^\.(\./\.\.)?$" $orig_srcdir ] } {
pass "test_tcl_orig_src"
} else {
fail "test_tcl_orig_src"
diff --git a/t/distcheck-pr18286.sh b/t/distcheck-pr18286.sh
new file mode 100644
index 000000000..fe8961287
--- /dev/null
+++ b/t/distcheck-pr18286.sh
@@ -0,0 +1,70 @@
+#! /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
+
+# Oops, we failed to distribute some required files!
+run_make -e FAIL -M distcheck
+$FGREP '../../test_data.txt' output
+
+# But if we distribute them, everything will be OK.
+echo 'EXTRA_DIST = test_data.txt gen-testdata.sh' >> Makefile.am
+
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 327c60eff..9363ee387 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -146,6 +146,7 @@ t/amopts-location.sh \
t/amopts-variable-expansion.sh \
t/amsubst.sh \
t/am-default-source-ext.sh \
+t/am-include-only-one-generated-fragment.sh \
t/ansi2knr-no-more.sh \
t/ar-lib.sh \
t/ar-lib2.sh \
@@ -431,6 +432,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 \
diff --git a/t/subdir-ac-subst.sh b/t/subdir-ac-subst.sh
index aae3c84f7..b3ede8cee 100644
--- a/t/subdir-ac-subst.sh
+++ b/t/subdir-ac-subst.sh
@@ -20,7 +20,7 @@
. test-init.sh
-cat >>configure.ac <<'END'
+cat >> configure.ac <<'END'
if test "$want_opt" = yes; then
MAYBE_OPT=opt
else
@@ -31,7 +31,7 @@ AC_CONFIG_FILES([src/Makefile opt/Makefile])
AC_OUTPUT
END
-cat >Makefile.am << 'END'
+cat > Makefile.am <<'END'
SUBDIRS = src $(MAYBE_OPT)
DIST_SUBDIRS = src opt
@@ -45,14 +45,16 @@ DIST_SUBDIRS = src opt
# We rely on 'distcheck' to run 'check-local' and use
# 'sanity1' and 'sanity2' as evidences that test-build was run.
+test_rootdir = $(top_builddir)/../../..
+
test-build: all
test -f src/result
if test -n "$(MAYBE_OPT)"; then \
test -f opt/result || exit 1; \
- : > $(top_builddir)/../../sanity2 || exit 1; \
+ : > $(test_rootdir)/sanity2 || exit 1; \
else \
test ! -f opt/result || exit 1; \
- : > $(top_builddir)/../../sanity1 || exit 1; \
+ : > $(test_rootdir)/sanity1 || exit 1; \
fi
test-dist: distdir
@@ -66,7 +68,7 @@ mkdir src opt
: > src/source
: > opt/source
-cat >src/Makefile.am << 'END'
+cat > src/Makefile.am <<'END'
EXTRA_DIST = source
all-local: result
CLEANFILES = result
@@ -76,7 +78,7 @@ result: source
END
# We want in opt/ the same Makefile as in src/. Let's exercise 'include'.
-cat >opt/Makefile.am << 'END'
+cat > opt/Makefile.am <<'END'
include ../src/Makefile.am
END
diff --git a/t/subdir-am-cond.sh b/t/subdir-am-cond.sh
index 73dba483a..69345d1a3 100644
--- a/t/subdir-am-cond.sh
+++ b/t/subdir-am-cond.sh
@@ -20,13 +20,13 @@
. test-init.sh
-cat >>configure.ac <<'END'
+cat >> configure.ac <<'END'
AM_CONDITIONAL([COND_OPT], [test "$want_opt" = yes])
AC_CONFIG_FILES([src/Makefile opt/Makefile])
AC_OUTPUT
END
-cat >Makefile.am << 'END'
+cat > Makefile.am <<'END'
if COND_OPT
MAYBE_OPT = opt
endif
@@ -42,16 +42,18 @@ SUBDIRS = src $(MAYBE_OPT)
# We rely on 'distcheck' to run 'check-local' and use
# 'sanity1' and 'sanity2' as evidences that test-build was run.
+test_rootdir = $(top_builddir)/../../..
+
if COND_OPT
test-build: all
test -f src/result
test -f opt/result
- : > $(top_builddir)/../../sanity2
+ : > $(test_rootdir)/sanity2
else
test-build: all
test -f src/result
test ! -f opt/result
- : > $(top_builddir)/../../sanity1
+ : > $(test_rootdir)/sanity1
endif
test-dist: distdir
@@ -65,7 +67,7 @@ mkdir src opt
: > src/source
: > opt/source
-cat >src/Makefile.am << 'END'
+cat > src/Makefile.am <<'END'
EXTRA_DIST = source
all-local: result
CLEANFILES = result
@@ -75,7 +77,7 @@ result: source
END
# We want in opt/ the same Makefile as in src/. Let's exercise 'include'.
-cat >opt/Makefile.am << 'END'
+cat > opt/Makefile.am <<'END'
include ../src/Makefile.am
END
diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh
index 2d4c670a6..50e34172f 100644
--- a/t/txinfo-builddir.sh
+++ b/t/txinfo-builddir.sh
@@ -43,7 +43,7 @@ CLEANFILES = mu.info
# to think 'version.texi' has been created...
check-local:
test ! -e mu.info
- test -f ../mu.info
+ test -f $(srcdir)/mu.info
END
mkdir subdir