]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Make test 'posixsubst-script' portable to MinGW/MSYS.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 18 Dec 2010 12:34:23 +0000 (13:34 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 18 Dec 2010 12:39:57 +0000 (13:39 +0100)
* 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
tests/posixsubst-scripts.test

index 6a2734771131d2b276efe83f99ff6cd023f3b708..7803a0015e38ce623a465b26baac3474a7d9f9c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-12-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       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.
index d5fe91eb0b1cfd957bc7bd0c3a0cd6a0c9307c7d..918bced79b2f06665aec2e58556f78e08ab26bc7 100755 (executable)
@@ -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