[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Test `$(var:suf=rpl)' expansion in special automake variable
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] Test `$(var:suf=rpl)' expansion in special automake variables. |
Date: |
Sun, 19 Dec 2010 18:41:58 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Saturday 18 December 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Sat, Dec 18, 2010 at 10:35:43AM CET:
> > On Saturday 18 December 2010, Ralf Wildenhues wrote:
> > > > +# Try also with `:=', to ensure the parser is not unduly confused
> > > > +# into thinking that it's an unportable assignement operator.
> > >
> > > This comment is bogus, right? There is no such thing as ':=' within
> > > $(var:A=B),
> > but there is in $(var:=x) (below this is "$(t1:=.sh)").
> >
> > > and the code below does not use := to assign variables.
> > >
> > Indeed, and so we want to enssure the automake parser does not
> > (errenously) think we are trying to do so.
> >
> > > What do you mean with this text? "Also try an empty match suffix."?
> > >
> > Yes; maybe a comment like this would be better?
> >
> > # Also try an empty match suffix, to ensure that the `:=' in there is
> > # not confused by the parser with an unportable assignement operator.
>
> Yes, thanks.
>
Done and pushed to master (see first attachement).
> > > These 'test -x' commands fail on MinGW/MSYS because the file system does
> > > not actually have execute permission information.
> > >
> > Ouch.
> >
> > > Instead, it is emulated by looking at the file, and returning 0 if the
> > > file starts with, e.g., a COFF header or with '#!'.
> > > (The same heuristic is used when executing a script as well.)
> > >
> > > You can thus fix this by either creating actual scripts in above rules
> > > and the file creation below, or by removing the tests here. I'm not
> > > sure which you prefer.
> > >
> > I'd prefer the former, to keep the coverage a little bigger on non-MinGW
> > systems. Is that ok?
>
> Yes, that's what I meant.
>
Done and pushed to master (see second attachement).
Thanks,
Stefano
From 080d362b919118033d054cb80b85cffc6d94cab6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 18 Dec 2010 12:58:04 +0100
Subject: [PATCH 1/2] Improve comments in tests `posixsubst*.test'.
* tests/posixsubst-data.test: Improve comment explaining why we
try also empty match suffix.
* tests/posixsubst-extradist.test: Likewise.
* tests/posixsubst-ldadd.test: Likewise.
* tests/posixsubst-libraries.test: Likewise.
* tests/posixsubst-ltlibraries.test: Likewise.
* tests/posixsubst-programs.test: Likewise.
* tests/posixsubst-scripts.test: Likewise.
* tests/posixsubst-sources.test: Likewise.
* tests/posixsubst-tests.test: Likewise.
Suggested by Ralf Wildenhues.
---
ChangeLog | 15 +++++++++++++++
tests/posixsubst-data.test | 4 ++--
tests/posixsubst-extradist.test | 4 ++--
tests/posixsubst-ldadd.test | 4 ++--
tests/posixsubst-libraries.test | 4 ++--
tests/posixsubst-ltlibraries.test | 4 ++--
tests/posixsubst-programs.test | 4 ++--
tests/posixsubst-scripts.test | 4 ++--
tests/posixsubst-sources.test | 4 ++--
tests/posixsubst-tests.test | 4 ++--
10 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index abeaf00..6a27347 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-18 Stefano Lattarini <address@hidden>
+
+ Improve comments in tests `posixsubst*.test'.
+ * tests/posixsubst-data.test: Improve comment explaining why we
+ try also empty match suffix.
+ * tests/posixsubst-extradist.test: Likewise.
+ * tests/posixsubst-ldadd.test: Likewise.
+ * tests/posixsubst-libraries.test: Likewise.
+ * tests/posixsubst-ltlibraries.test: Likewise.
+ * tests/posixsubst-programs.test: Likewise.
+ * tests/posixsubst-scripts.test: Likewise.
+ * tests/posixsubst-sources.test: Likewise.
+ * tests/posixsubst-tests.test: Likewise.
+ Suggested by Ralf Wildenhues.
+
2010-12-16 Ralf Wildenhues <address@hidden>
Fix typos in test comments.
diff --git a/tests/posixsubst-data.test b/tests/posixsubst-data.test
index f1ffeae..210279f 100755
--- a/tests/posixsubst-data.test
+++ b/tests/posixsubst-data.test
@@ -36,8 +36,8 @@ bar.data bazzardoz:
: > $@
CLEANFILES = bar.data bazzardoz
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
dist_foo_DATA = $(t1:=.txt)
foo_DATA = $(t2:x=.data)
nodist_foo_DATA = $(t3:.y=zardoz)
diff --git a/tests/posixsubst-extradist.test b/tests/posixsubst-extradist.test
index c3bf970..c9a20bf 100755
--- a/tests/posixsubst-extradist.test
+++ b/tests/posixsubst-extradist.test
@@ -29,8 +29,8 @@ cat > Makefile.am << 'END'
t1 = foo1 foo2
t2 = bar.x
t3 = baz-y
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
EXTRA_DIST = $(t1:=.c) $(t2:.x=.f) $(t3:-y=ar)
bazar bar.f:
: > $@
diff --git a/tests/posixsubst-ldadd.test b/tests/posixsubst-ldadd.test
index fa3a12c..6eb29f9 100755
--- a/tests/posixsubst-ldadd.test
+++ b/tests/posixsubst-ldadd.test
@@ -37,8 +37,8 @@ zardoz_PROGRAMS = foo bar
noinst_LIBRARIES = libquux1.a libquux2.a libquux3.a
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
LDADD = $(u:.lib=.a)
bar_LDADD = $(v:=.a) libquux2.a $(w:none=libquux3.a)
diff --git a/tests/posixsubst-libraries.test b/tests/posixsubst-libraries.test
index 79b96bc..90cc2e5 100755
--- a/tests/posixsubst-libraries.test
+++ b/tests/posixsubst-libraries.test
@@ -32,8 +32,8 @@ cat > Makefile.am << 'END'
foolibs = libfoo1 libfoo2
barlibs = libbaz
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
lib_LIBRARIES = $(foolibs:=.a) $(barlibs:z=r.a)
libbar.c:
diff --git a/tests/posixsubst-ltlibraries.test
b/tests/posixsubst-ltlibraries.test
index c482db4..93a1d57 100755
--- a/tests/posixsubst-ltlibraries.test
+++ b/tests/posixsubst-ltlibraries.test
@@ -33,8 +33,8 @@ cat > Makefile.am << 'END'
foolibs = libfoo1 libfoo2
barlibs = libbaz
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
lib_LTLIBRARIES = $(foolibs:=.la) $(barlibs:z=r.la)
libbar.c:
diff --git a/tests/posixsubst-programs.test b/tests/posixsubst-programs.test
index a8471f6..69252dd 100755
--- a/tests/posixsubst-programs.test
+++ b/tests/posixsubst-programs.test
@@ -30,8 +30,8 @@ cat > Makefile.am << 'END'
t1 = foo1 foo2
t2 = barx bar2
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
bin_PROGRAMS = $(t1:=-p) $(t2:2=y)
installcheck-local:
diff --git a/tests/posixsubst-scripts.test b/tests/posixsubst-scripts.test
index a6f253b..d5fe91e 100755
--- a/tests/posixsubst-scripts.test
+++ b/tests/posixsubst-scripts.test
@@ -34,8 +34,8 @@ bar1 bar2 quux.pl:
: > $@
CLEANFILES = bar1 bar2 quux.pl
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
dist_sbin_SCRIPTS = $(t1:=.sh)
libexec_SCRIPTS = $(t2:x=)
nodist_bin_SCRIPTS = $(t3:-baz=x.pl)
diff --git a/tests/posixsubst-sources.test b/tests/posixsubst-sources.test
index 97f4e55..14d438d 100755
--- a/tests/posixsubst-sources.test
+++ b/tests/posixsubst-sources.test
@@ -33,8 +33,8 @@ FOO = foo.cxx
BAR = bar__
BAZ = baz.
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
foo_SOURCES = main.c $(FOO:.cxx=.c)
dist_foo_SOURCES = $(BAR:__=.c)
nodist_foo_SOURCES = $(BAZ:=c)
diff --git a/tests/posixsubst-tests.test b/tests/posixsubst-tests.test
index 98305ae..3fca8f4 100755
--- a/tests/posixsubst-tests.test
+++ b/tests/posixsubst-tests.test
@@ -34,8 +34,8 @@ foo2.test barz:
(echo '#!/bin/sh' && echo 'exit 0') > $@ && chmod a+x $@
CLEANFILES = foo2.test barz # for FreeBSD make
-# Try also with `:=', to ensure the parser is not unduly confused
-# into thinking that it's an unportable assignment operator.
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
TESTS = $(t1:=.test) $(t2:x=y) $(t3:2=z)
EXTRA_DIST = $(TESTS)
--
1.7.1
From 3d6cd2896c637a24a9c125ef81506d911c3087d4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 18 Dec 2010 13:34:23 +0100
Subject: [PATCH 2/2] Make test 'posixsubst-script' portable to MinGW/MSYS.
* tests/posixsubst-script.test: Ensure that the generated dummy
scripts really start with a shebang line, to work around a
limitation of 'test -x' on MinGW/MSYS.
Reported by Ralf Wildenhues.
---
ChangeLog | 6 ++++++
tests/posixsubst-scripts.test | 20 ++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a27347..7803a00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2010-12-18 Stefano Lattarini <address@hidden>
+ Make test 'posixsubst-script' portable to MinGW/MSYS.
+ * tests/posixsubst-script.test: Ensure that the generated dummy
+ scripts really start with a shebang line, to work around a
+ limitation of 'test -x' on MinGW/MSYS.
+ Reported by Ralf Wildenhues.
+
Improve comments in tests `posixsubst*.test'.
* tests/posixsubst-data.test: Improve comment explaining why we
try also empty match suffix.
diff --git a/tests/posixsubst-scripts.test b/tests/posixsubst-scripts.test
index d5fe91e..918bced 100755
--- a/tests/posixsubst-scripts.test
+++ b/tests/posixsubst-scripts.test
@@ -25,13 +25,22 @@ cat >> configure.in << 'END'
AC_OUTPUT
END
+# We have to be careful with 'test -x' commands on MinGW/MSYS, because
+# the file system does not actually have execute permission information.
+# Instead, that is emulated by looking at the file content, and returning
+# 0 if the file starts with, e.g., a COFF header or with '#!'.
+# So we need to create actual scripts in the make rules and in the file
+# creation below.
+
cat > Makefile.am << 'END'
t1 = foo1 foo2
t2 = bar1x bar2
t3 = quu-baz
-bar1 bar2 quux.pl:
- : > $@
+bar1 bar2:
+ (echo '#!/bin/sh' && echo 'exit 0') > $@
+quux.pl:
+ (echo '#!/bin/perl' && echo '1;') > $@
CLEANFILES = bar1 bar2 quux.pl
# Also try an empty match suffix, to ensure that the `:=' in there is
@@ -71,8 +80,11 @@ installcheck-local:
test -x $(prefix)/bin/quux.pl
END
-: > foo1.sh
-: > foo2.sh
+cat > foo1.sh <<'END'
+#!/bin/sh
+exit 0
+END
+cp foo1.sh foo2.sh
$ACLOCAL
$AUTOCONF
--
1.7.1