]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
coverage: dist-hook and distcheck-hook can modify file permission
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 24 Feb 2012 17:34:04 +0000 (18:34 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 25 Feb 2012 17:31:04 +0000 (18:31 +0100)
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.

tests/distcheck-writable-srcdir.test [new file with mode: 0755]
tests/disthook-perms.test [new file with mode: 0755]
tests/list-of-tests.mk

diff --git a/tests/distcheck-writable-srcdir.test b/tests/distcheck-writable-srcdir.test
new file mode 100755 (executable)
index 0000000..bbc50f4
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 (executable)
index 0000000..a5f0acb
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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'
+
+:
index eaaa88877091deb8fe93b7271e948b774d2f7ff8..5507ee5b0c4676f24ea7ca7743614292b7b2dab7 100644 (file)
@@ -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 \