From: Stefano Lattarini Date: Fri, 24 Feb 2012 17:34:04 +0000 (+0100) Subject: coverage: dist-hook and distcheck-hook can modify file permission X-Git-Tag: v1.11b~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e839f9acc95c0b4c4ab602f28e29d9413e084ce;p=thirdparty%2Fautomake.git coverage: dist-hook and distcheck-hook can modify file permission See automake bug#10878. * tests/dist-hook-perms.test: New test, checking that the user can use the 'dist-hook' target to modify permissions of distributed files before putting them in the distribution tarball. * tests/distcheck-writable-srcdir.test: New test, checking that the user can use 'distcheck-hook' to ensure his packages is built by "make distcheck" with a writable srcdir. This goes against the GNU Coding Standards, but some package authors might not care about them too much, and it's nice to support their use case too. * tests/list-of-tests.mk: Add them. --- diff --git a/tests/distcheck-writable-srcdir.test b/tests/distcheck-writable-srcdir.test new file mode 100755 index 000000000..bbc50f461 --- /dev/null +++ b/tests/distcheck-writable-srcdir.test @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Check that the user abuse 'distcheck-hook' to ensure his packages +# is built by "make distcheck" with a writable srcdir. This goes +# against the GNU Coding Standards, but some package authors might +# not care about them too much, and it's nice to support their use +# case too (since it doesn't cost us anything but this test). +# See automake bug#10878. + +. ./defs || Exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +EXTRA_DIST = old +distcheck-hook: + find $(distdir) -exec chmod u+w '{}' ';' +check-local: + test -f $(srcdir)/old + test ! -f $(srcdir)/new + test ! -r $(srcdir)/new +## Don't do this in real life, or I'll kill you. + echo foo > $(srcdir)/old + echo bar > $(srcdir)/new +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF +./configure +: > old +$MAKE distcheck + +: diff --git a/tests/disthook-perms.test b/tests/disthook-perms.test new file mode 100755 index 000000000..a5f0acbfd --- /dev/null +++ b/tests/disthook-perms.test @@ -0,0 +1,59 @@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Check that the user can use the 'dist-hook' target to modify +# permissions of distributed files before putting them in the +# distribution tarball. See automake bug#10878. + +. ./defs || Exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +EXTRA_DIST = write execute +dist-hook: + chmod u+w $(distdir)/write + chmod u+x $(distdir)/execute +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +echo Will be clobbered > write +cat > execute <<'END' +#!/bin/sh +echo I run successfully +END + +chmod a-w write +chmod a-x execute + +$MAKE +$MAKE dist + +test -f $distdir.tar.gz +gzip -dc $distdir.tar.gz | tar xvf - + +cd $distdir +echo clobber clobber > write +cat write | grep 'clobber clobber' +./execute +./execute | grep 'I run successfully' + +: diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index eaaa88877..5507ee5b0 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -355,6 +355,7 @@ distcom4.test \ distcom5.test \ distcom-subdir.test \ distdir.test \ +disthook-perms.test \ distlinks.test \ distlinksbrk.test \ distname.test \ @@ -363,6 +364,7 @@ distcheck-configure-flags-am.test \ distcheck-configure-flags-subpkg.test \ distcheck-hook.test \ distcheck-hook2.test \ +distcheck-writable-srcdir.test \ distcheck-missing-m4.test \ distcheck-outdated-m4.test \ distcheck-override-infodir.test \