From 498492fdb4dd7db6a0d3aa631c350a57da3d2ab5 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 30 Jun 2012 16:37:06 +0200 Subject: [PATCH] coverage: regression in texinfo "make mostlyclean" with $(SUBDIRS) After commit v1.12.1-91-g205c757 of 2012-06-20, "texi: require Texinfo >= 4.9, related enhancements", the presence of a Texinfo manual 'manual.texi' in a subdir (say 'doc/') of a package using a recursive make setup would cause "make distcheck" to fail, due to the presence of the 'manual.t2d/' directory created by texi2dvi. That directory would not be correctly removed because the 'mostlyclean' rule would run, from within the 'doc/' sub-directory, "rm -rf doc/manual.t2d", instead of the expected (and correct) "rm -rf manual.t2d". Reported by Jim Meyering: * t/txinfo21.sh: Enhance to expose the issue. * t/txinfo-no-clutter.sh: Likewise, and other miscellaneous improvements. Signed-off-by: Stefano Lattarini --- t/txinfo-no-clutter.sh | 88 +++++++++++++++++++++++++++++++----------- t/txinfo21.sh | 17 +++++++- 2 files changed, 81 insertions(+), 24 deletions(-) diff --git a/t/txinfo-no-clutter.sh b/t/txinfo-no-clutter.sh index 3dc1a2928..558f8e101 100755 --- a/t/txinfo-no-clutter.sh +++ b/t/txinfo-no-clutter.sh @@ -14,19 +14,28 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# The pdf, ps and dvi targets shouldn't let clutter in the build directory. -# Related to automake bug#11146. +# The info, html, pdf, ps and dvi targets shouldn't let clutter in the +# build directory. Related to automake bug#11146. required='makeinfo tex texi2dvi dvips' . ./defs || exit 1 -mkdir sub - -echo AC_OUTPUT >> configure.ac +cat >> configure.ac <<'END' +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END cat > Makefile.am << 'END' -all-local: ps pdf dvi html -info_TEXINFOS = foo.texi sub/bar.texi +all-local: ps pdf dvi html # For "make distcheck". +info_TEXINFOS = foo.texi doc/bar.texi baz.texi +SUBDIRS = sub +END + +mkdir sub doc + +cat > sub/Makefile.am << 'END' +all-local: ps pdf dvi html # For "make distcheck". +info_TEXINFOS = baz.texi END cat > foo.texi << 'END' @@ -39,7 +48,7 @@ Hello walls. @bye END -cat > sub/bar.texi << 'END' +cat > doc/bar.texi << 'END' \input texinfo @setfilename bar.info @settitle bar @@ -49,15 +58,6 @@ Hello walls. @bye END -cat > baz.texi << 'END' -\input texinfo -@setfilename baz.info -@settitle baz -@node Top -Hello walls. -@bye -END - cat > baz.texi << 'END' \input texinfo @setfilename baz.info @@ -81,6 +81,8 @@ sb @bye END +cp baz.texi sub + $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF @@ -91,11 +93,53 @@ $AUTOCONF # clean up potential cruft left by earlier ones. for fmt in info pdf ps dvi html all; do $MAKE $fmt - ls -l . sub # For debugging. - ls -d foo* baz* sub/bar* > lst - $EGREP -v '^(foo|sub/bar|baz)\.(texi|dvi|ps|pdf|html|info|t2[dp])$' \ - lst && exit 1 - $MAKE clean + # For debugging. + ls -l . doc sub + # Sanity check. + case $fmt in + html) + test -e foo.html + test -e doc/bar.html + test -e baz.html + test -e sub/baz.html + ;; + all) + for x in info pdf ps dvi; do + test -f foo.$x + test -f doc/bar.$x + test -f baz.$x + test -f sub/baz.$x + done + test -e foo.html + test -e doc/bar.html + test -e baz.html + test -e sub/baz.html + ;; + *) + test -f foo.$fmt + test -f doc/bar.$fmt + test -f baz.$fmt + test -f sub/baz.$fmt + ;; + esac + # Real test. + ls -d foo* baz* sub/baz* doc/bar* > lst + basename_rx='(foo|doc/bar|baz|sub/baz)' + case $fmt in + pdf) extension_rx="(texi|pdf|t2p)";; + dvi) extension_rx="(texi|dvi|t2d)";; + ps) extension_rx="(texi|ps|dvi|t2d)";; + info) extension_rx="(texi|info)";; + html) extension_rx="(texi|html)";; + all) extension_rx="(texi|html|info|pdf|ps|dvi|t2[pd])";; + *) fatal_ "unreachable code reached";; + esac + $EGREP -v "^$basename_rx\.$extension_rx$" lst && exit 1 + # Cleanup for checks on the next format. + case $fmt in + info) rm -f *.info doc/*.info sub/*.info;; + *) $MAKE clean;; + esac done $MAKE distcheck diff --git a/t/txinfo21.sh b/t/txinfo21.sh index 52474ad35..b6c222f19 100755 --- a/t/txinfo21.sh +++ b/t/txinfo21.sh @@ -34,6 +34,7 @@ AC_OUTPUT EOF cat > Makefile.am << 'END' +check-local: ps pdf dvi html # For "make distcheck". SUBDIRS = rec info_TEXINFOS = main.texi sub/main2.texi END @@ -75,13 +76,15 @@ install-pdf-local: :> "$(pdfdir)/hello" uninstall-local: rm -f "$(pdfdir)/hello" + +check-local: ps pdf dvi html # For "make distcheck". END $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -./configure +./configure --prefix "$(pwd)" $MAKE @@ -115,17 +118,20 @@ test ! -e sub/main2.html test ! -e rec/main3.html # Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO. + +cp Makefile.am Makefile.sav cat >>Makefile.am <<\EOF AM_MAKEINFOHTMLFLAGS = --no-headers --no-split AM_MAKEINFOFLAGS = --unsupported-option EOF $AUTOMAKE -./configure --prefix "$(pwd)" +./config.status Makefile $MAKE html test -f main.html test -f sub/main2.html test -d rec/main3.html + $MAKE clean test ! -e main.html test ! -e sub/main2.html @@ -174,4 +180,11 @@ test ! -e share/$me/pdf/main2.pdf test ! -e share/$me/pdf/main3.pdf test ! -e share/$me/pdf/hello +# Restore the makefile without a broken AM_MAKEINFOFLAGS definition. +mv -f Makefile.sav Makefile.am +$AUTOMAKE +./config.status Makefile + +$MAKE distcheck + : -- 2.47.2