[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] {maint} tests: improve tests on "maintainer-clean" target
From: |
Stefano Lattarini |
Subject: |
[PATCH] {maint} tests: improve tests on "maintainer-clean" target |
Date: |
Wed, 30 Mar 2011 17:47:44 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Hello automakers. While looking at the test aclocal6.test (during the attemp
of tackling <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8365>) I noticed
this comment:
# Make sure maintainer-clean works in VPATH builds.
# (This is unrelated to the rest of this test.)
Having two very unrelated checks in the same test script is Not A Nice Thing
IMHO.
So I've seized this opportunity to do some minor refactoring and extending in
the tests for the "maintainer-clean" target. The resulting simple patch (for
maint) is attached. A quick "grep maintainer-clean *.test" should show that
I haven't just duplicated existing checks.
I'll push in 72 hours if there are no objections.
Regards,
Stefano
From ddb25a2747942caa8eaa85c0c775d44a04ea1f9d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
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 | 11 ++++
tests/Makefile.am | 1 +
tests/Makefile.in | 1 +
tests/aclocal6.test | 20 +-------
tests/maintclean-vpath.test | 115 +++++++++++++++++++++++++++++++++++++++++++
tests/maintclean.test | 41 +++++++++++++--
6 files changed, 165 insertions(+), 24 deletions(-)
create mode 100755 tests/maintclean-vpath.test
diff --git a/ChangeLog b/ChangeLog
index dae2a48..972f4f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-03-30 Stefano Lattarini <address@hidden>
+
+ 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.
+
2011-03-21 Ralf Wildenhues <address@hidden>
tests: fix unindent to use printf not echo for script.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4becdbb..bfa8edf 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 b9b1f6e..ed89d07 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 ea6bac3..220bf90 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 0000000..8b622bc
--- /dev/null
+++ b/tests/maintclean-vpath.test
@@ -0,0 +1,115 @@
+#! /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 <http://www.gnu.org/licenses/>.
+
+# 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 a66464b..6503864 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,17 +15,22 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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:
@@ -35,7 +40,20 @@ MAINTAINERCLEANFILES = foo.c
END
-touch bar.in
+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
@@ -48,18 +66,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 +89,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
+
+:
--
1.7.2.3
- [PATCH] {maint} tests: improve tests on "maintainer-clean" target,
Stefano Lattarini <=