From 1dd55a48e354e57686879ea9900c8daf0402a10a Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 30 Mar 2011 12:48:42 +0200 Subject: [PATCH] tests: improve tests on "maintainer-clean" target * tests/aclocal6.test: Move checks related to "maintainer-clean" functionalities into ... * tests/maintclean-vpath.test: ... this new test. * tests/maintclean.test: Update heading comments. Extend to also test subdirs. Remove useless disabling of YACC. Fix m4 quoting in configure.in. Add a trailing `:' command. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 12 ++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/aclocal6.test | 20 +------ tests/maintclean-vpath.test | 106 ++++++++++++++++++++++++++++++++++++ tests/maintclean.test | 36 +++++++++--- 6 files changed, 150 insertions(+), 26 deletions(-) create mode 100755 tests/maintclean-vpath.test diff --git a/ChangeLog b/ChangeLog index dae2a485a..0c2d4165a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-03-30 Stefano Lattarini + + tests: improve tests on "maintainer-clean" target + * tests/aclocal6.test: Move checks related to "maintainer-clean" + functionalities into ... + * tests/maintclean-vpath.test: ... this new test. + * tests/maintclean.test: Update heading comments. Extend to also + test subdirs. Remove useless disabling of YACC. Fix m4 quoting + in configure.in. Add a trailing `:' command. Remove extra blank + lines. + * tests/Makefile.am (TESTS): Update. + 2011-03-21 Ralf Wildenhues tests: fix unindent to use printf not echo for script. diff --git a/tests/Makefile.am b/tests/Makefile.am index 4becdbb1d..bfa8edfe3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -489,6 +489,7 @@ ltorder.test \ lzma.test \ m4-inclusion.test \ maintclean.test \ +maintclean-vpath.test \ make.test \ makej.test \ makej2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b9b1f6e13..ed89d0726 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -759,6 +759,7 @@ ltorder.test \ lzma.test \ m4-inclusion.test \ maintclean.test \ +maintclean-vpath.test \ make.test \ makej.test \ makej2.test \ diff --git a/tests/aclocal6.test b/tests/aclocal6.test index ea6bac303..220bf90fb 100755 --- a/tests/aclocal6.test +++ b/tests/aclocal6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2011 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 @@ -44,13 +44,6 @@ $ACLOCAL -I m4 $AUTOCONF $AUTOMAKE --copy --add-missing -# Users can disable autom4te.cache. -if test -d autom4te.cache; then - test_cache='test -d' -else - test_cache=: -fi - mkdir build cd build @@ -79,15 +72,4 @@ test -f $me-1.0/m4/moredefs.m4 test -f $me-1.0/m4/somedefs.m4 test -f $me-1.0/acinclude.m4 -# Make sure maintainer-clean works in VPATH builds. -# (This is unrelated to the rest of this test.) -$MAKE clean -$test_cache ../autom4te.cache -test -f Makefile -test -f sub/Makefile -$MAKE maintainer-clean -test ! -d ../autom4te.cache -test ! -f Makefile -test ! -f sub/Makefile - : diff --git a/tests/maintclean-vpath.test b/tests/maintclean-vpath.test new file mode 100755 index 000000000..8dd2a9542 --- /dev/null +++ b/tests/maintclean-vpath.test @@ -0,0 +1,106 @@ +#! /bin/sh +# Copyright (C) 2011 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 . + +# Make sure distclean and maintainer-clean erase the right files. +# This test is for VPATH builds; see sister test `maintclean-vpath.test' +# for in-tree builds. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_FILES([bar sub/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +SUBDIRS = sub +noinst_DATA = foo.c +foo.c: + touch foo.c +MAINTAINERCLEANFILES = foo.c +END + +mkdir sub +cat > sub/Makefile.am <<'END' +noinst_SCRIPTS = zap +zap: zap.sh + cp $(srcdir)/zap.sh $@ && chmod a+x $@ +MAINTAINERCLEANFILES = zap +END + +: > bar.in +: > sub/zap.sh + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +# Users can disable autom4te.cache. +if test -d autom4te.cache; then + test_cache='test -d ../autom4te.cache' +else + test_cache=: +fi + +mkdir build + +chmod a-w . sub + +cd build + +../configure +test -f bar + +$MAKE +test -f foo.c +test -f sub/zap +$test_cache + +$MAKE distclean +test ! -f bar +test ! -f Makefile +test ! -f sub/Makefile +test ! -f config.status +test -f foo.c +test -f sub/zap +test -f ../sub/zap.sh +$test_cache + +../configure +test -f bar + +$MAKE foo.c +test -f foo.c +cd sub +$MAKE zap +test -f zap +cd .. + +chmod u+w .. + +$MAKE maintainer-clean +test -f ../sub/zap.sh +test ! -f bar +test ! -f foo.c +test ! -f sub/zap +test ! -f Makefile +test ! -f sub/Makefile +test ! -f config.status +test ! -d ../autom4te.cache + +: diff --git a/tests/maintclean.test b/tests/maintclean.test index a66464b03..9e2246393 100755 --- a/tests/maintclean.test +++ b/tests/maintclean.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2011 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 @@ -15,27 +15,36 @@ # along with this program. If not, see . # Make sure distclean and maintainer-clean erase the right files. +# This test is for in-tree builds; see sister test `maintclean-vpath.test' +# for VPATH builds. . ./defs || Exit 1 set -e cat >> configure.in << 'END' -AC_CONFIG_FILES(bar) +AC_CONFIG_FILES([bar sub/Makefile]) AC_OUTPUT END cat > Makefile.am <<'END' +SUBDIRS = sub noinst_DATA = foo.c - foo.c: touch foo.c - MAINTAINERCLEANFILES = foo.c +END +mkdir sub +cat > sub/Makefile.am <<'END' +noinst_SCRIPTS = zap +zap: zap.sh + cp $(srcdir)/zap.sh $@ && chmod a+x $@ +MAINTAINERCLEANFILES = zap END -touch bar.in +: > bar.in +: > sub/zap.sh $ACLOCAL $AUTOCONF @@ -48,18 +57,22 @@ else test_cache=: fi -# Since we don't require Yacc, make sure it's not used. -./configure YACC=false +./configure test -f bar $MAKE test -f foo.c +test -f sub/zap +$test_cache $MAKE distclean test ! -f bar test ! -f Makefile +test ! -f sub/Makefile test ! -f config.status test -f foo.c +test -f sub/zap +test -f sub/zap.sh $test_cache ./configure @@ -67,10 +80,19 @@ test -f bar $MAKE foo.c test -f foo.c +cd sub +$MAKE zap +test -f zap +cd .. $MAKE maintainer-clean +test -f sub/zap.sh test ! -f bar test ! -f foo.c +test ! -f sub/zap test ! -f Makefile +test ! -f sub/Makefile test ! -f config.status test ! -d autom4te.cache + +: -- 2.47.2