>From 02ce5d5a0ce42563e8aa8ea03a977d35f3a30f72 Mon Sep 17 00:00:00 2001
Message-Id:
From: Stefano Lattarini
Date: Tue, 14 Feb 2012 19:26:29 +0100
Subject: [PATCH] tests: avoid ksh bug for wildcards in EXTRA_DIST
Some shells, like NetBSD 5.1 /bin/ksh, have a bug that causes
wildcards resulting from an unquoted parameter expansion not to
be expanded as expected in some cases:
$ touch a b c d
$ /bin/sh -c 'var="[ab]" && echo $var' # As expected.
a b
$ /bin/ksh -c 'var="[ab]" && echo $var' # Oops.
[ab]
$ /bin/ksh -c 'var="?" && echo $var' # But this as expected.
a b c d
This was causing a failure in our testsuite. Work around that.
See also:
* tests/extra11.test: Work around the described issue by using the
$(wildcard) builtin in the EXTRA_DIST definition. This is not a
problem, since this test was assuming GNU make anyway. Since we are
at it, enhance coverage a little by also running "make distcheck".
* tests/extra10.test: Similarly, enhance coverage by also running
"make distcheck", and fix a minor bug in the process. But continue
using a "bare" wildcard expression in EXTRA_DIST, without involving
the $(wildcard) builtin, to ensure coverage of similar usages "in
the wild".
---
tests/extra10.test | 14 ++++++++++++--
tests/extra11.test | 26 ++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/tests/extra10.test b/tests/extra10.test
index f44b1e2..a635f9c 100755
--- a/tests/extra10.test
+++ b/tests/extra10.test
@@ -16,6 +16,8 @@
# Check that wildcards in EXTRA_DIST are honoured.
# Suggested by observations from Braden McDaniel.
+# See also sister test 'extra11.test', that check a similar usage
+# with the involvement of the $(wildcard) GNU make builtin.
required=GNUmake
. ./defs || Exit 1
@@ -23,12 +25,16 @@ required=GNUmake
echo AC_OUTPUT >> configure.in
cat > Makefile.am <<'END'
-EXTRA_DIST=*.foo
+EXTRA_DIST = *.foo
.PHONY: test
test: distdir
diff a.foo $(distdir)/a.foo
diff b.foo $(distdir)/b.foo
test ! -r $(distdir)/c.bar
+check-local:
+ test -f $(srcdir)/a.foo
+ test -f $(srcdir)/b.foo
+ test ! -r $(srcdir)/c.bar
END
$ACLOCAL
@@ -37,6 +43,10 @@ $AUTOCONF
echo aaa > a.foo
echo bbb > b.foo
-echo ccc > c.foo
+echo ccc > c.bar
./configure
$MAKE test
+
+$MAKE distcheck
+
+:
diff --git a/tests/extra11.test b/tests/extra11.test
index fb7c559..38b1654 100755
--- a/tests/extra11.test
+++ b/tests/extra11.test
@@ -23,7 +23,9 @@ required=GNUmake
echo AC_OUTPUT >> configure.in
cat > Makefile.am <<'END'
-EXTRA_DIST = [!c-z].t d.t [ab].dir foo.* *zardoz*
+AUTOMAKE_OPTIONS = -Wno-portability
+
+EXTRA_DIST = $(wildcard [!c-z].t d.t [ab].dir foo.* *zardoz*)
.PHONY: prereq
prereq:
@@ -45,6 +47,7 @@ prereq:
.PHONY: test
test: distdir
+ ls -l $(distdir) $(distdir)/*.dir ;: For debugging.
diff a.t $(distdir)/a.t
diff b.t $(distdir)/b.t
test ! -r $(distdir)/c.t
@@ -59,6 +62,22 @@ test: distdir
diff foo.bar $(distdir)/foo.bar
test ! -r $(distdir)/foo
diff _zardoz_ $(distdir)/_zardoz_
+check-local:
+ ls -l . *.dir ;: For debugging.
+ test -f $(srcdir)/a.t
+ test -f $(srcdir)/b.t
+ test ! -r $(srcdir)/c.t
+ test -f $(srcdir)/d.t
+ test ! -r $(srcdir)/m.t
+ test ! -r $(srcdir)/z.t
+ test -f $(srcdir)/a.dir/f1
+ test -f $(srcdir)/a.dir/f2
+ test -f $(srcdir)/b.dir/f
+ test ! -r $(srcdir)/c.dir
+ test -f $(srcdir)/foo.x
+ test -f $(srcdir)/foo.bar
+ test ! -r $(srcdir)/foo
+ test -f $(srcdir)/_zardoz_
END
$ACLOCAL
@@ -67,5 +86,8 @@ $AUTOCONF
./configure
$MAKE prereq
-ls -l . *.dir
+ls -l . *.dir # For debugging.
$MAKE test
+$MAKE distcheck
+
+:
--
1.7.7.3