]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] tests: fix spurious failures on NetBSD
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 7 Jul 2012 23:04:48 +0000 (01:04 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 8 Jul 2012 07:45:54 +0000 (09:45 +0200)
* t/built-sources.sh (Makefile.am): In a recipe, use 'printf', not 'echo',
to print a string containing a "\n" sequence, because that is interpreted
like a newline by the echo built-in of NetBSD 5.1 /bin/ksh.
* t/maken.sh: Don't expect the timestamp of the current directory to be
unchanged after "make -n" is run in it; this doesn't hold on NetBSD 5.1.
Instead, make the current directory unwritable before running "make -n",
to ensure attempts to modify the directory fail.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/built-sources.sh
t/maken.sh

index 902cee10d7963579c1eb491ca9b293a77cf3d050..b61b556bd3899bb66740ffd515b2a49e0ee6180f 100755 (executable)
@@ -29,12 +29,14 @@ BUILT_SOURCES = foo.c
 noinst_PROGRAMS = bar baz
 foo.c:
        rm -f $@ $@-t
-       echo '#include <stdio.h>'               >  $@-t
-       echo 'int main (void)'                  >> $@-t
-       echo '{               '                 >> $@-t
-       echo '  printf ("%s\n", FOOMSG);'       >> $@-t
-       echo '  return 0;'                      >> $@-t
-       echo '}'                                >> $@-t
+       # Use printf, not echo, to avoid spurious interpretation of
+       # the "\n" as a newline (see on NetBSD 5.1).
+       printf '%s\n' '#include <stdio.h>'               >  $@-t
+       printf '%s\n' 'int main (void)'                  >> $@-t
+       printf '%s\n' '{               '                 >> $@-t
+       printf '%s\n' '  printf ("%s\n", FOOMSG);'       >> $@-t
+       printf '%s\n' '  return 0;'                      >> $@-t
+       printf '%s\n' '}'                                >> $@-t
        mv -f $@-t $@
 CLEANFILES = foo.c
 END
index ec992bf051cebe215a72fa3116a4ffe8f0bcc44e..e4254e532430dbe705f74da5920d238cefe110be 100755 (executable)
@@ -50,10 +50,12 @@ $AUTOMAKE
 for target in dist distcheck; do
   echo stamp > stampfile
   $sleep
+  chmod a-w .
   $MAKE -n $target
   $MAKE -n $target | grep stamp-sub-dist-hook
+  chmod u+w .
   # No file has been actually touched or created.
-  is_newest stampfile $(find .)
+  is_newest stampfile $(find . | grep -v '^\.$')
   $MAKE test-no-distdir
 done