coverage: regression in texinfo "make mostlyclean" with $(SUBDIRS)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 30 Jun 2012 14:37:06 +0000 (16:37 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 30 Jun 2012 15:16:09 +0000 (17:16 +0200)
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:
<http://lists.gnu.org/archive/html/automake-patches/2012-06/msg00203.html>

* t/txinfo21.sh: Enhance to expose the issue.
* t/txinfo-no-clutter.sh: Likewise, and other miscellaneous improvements.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/txinfo-no-clutter.sh
t/txinfo21.sh

index 3dc1a29..558f8e1 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# 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
@@ -53,15 +62,6 @@ 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
-@settitle baz
 @defindex au
 @defindex sa
 @defindex sb
@@ -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
index 52474ad..b6c222f 100755 (executable)
@@ -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
+
 :