Home | History | Annotate | Line # | Download | only in util
      1  1.1  christos #!/bin/sh
      2  1.1  christos # Id: txitextest,v 1.5 2004/04/11 17:56:47 karl Exp 
      3  1.1  christos # Test texinfo.tex changes by running various manuals through with an
      4  1.1  christos # old version, saving the .ps result from dvips, doing the same with a
      5  1.1  christos # new version, and comparing.  Idea from Stepan Kasal.
      6  1.1  christos # 
      7  1.1  christos # Another option is to run the manuals all the way through using
      8  1.1  christos # texi2dvi, which tests in another way.
      9  1.1  christos 
     10  1.1  christos tsrc=/u/texinfo/src
     11  1.1  christos PATH=$tsrc/util:$PATH
     12  1.1  christos 
     13  1.1  christos tdoc=$tsrc/doc
     14  1.1  christos default_manuals="$tdoc/texinfo.txi $tdoc/info.texi $tdoc/info-stnd.texi"
     15  1.1  christos 
     16  1.1  christos olddir=$HOME/gnu/src/gnulib/config
     17  1.1  christos newdir=$tdoc
     18  1.1  christos tempdir=/u/texinfo/@tests/testdir
     19  1.1  christos full=false
     20  1.1  christos manuals=
     21  1.1  christos 
     22  1.1  christos while test $# -gt 0; do
     23  1.1  christos   case $1 in
     24  1.1  christos   --f*) full=true;;
     25  1.1  christos   --o*) shift; olddir="$1";;
     26  1.1  christos   --n*) shift; newdir="$1";;
     27  1.1  christos   --t*) shift; tempdir="$1";;
     28  1.1  christos   -*) echo "$0: unknown option \`$1'." >&2; exit 1;;
     29  1.1  christos   *) manuals="$manuals $1";;
     30  1.1  christos   esac
     31  1.1  christos   shift
     32  1.1  christos done
     33  1.1  christos 
     34  1.1  christos test -z "$manuals" && manuals=$default_manuals
     35  1.1  christos initial_dir=`pwd`
     36  1.1  christos 
     37  1.1  christos cd $tempdir || exit 1
     38  1.1  christos rm -f *
     39  1.1  christos 
     40  1.1  christos run_tex() \
     41  1.1  christos {
     42  1.1  christos   TEXINPUTS=.:$mandir: tex $manual \
     43  1.1  christos   || { echo "tex $manual failed." >&2; exit 1; }
     44  1.1  christos }
     45  1.1  christos 
     46  1.1  christos for manual in $manuals; do
     47  1.1  christos   mandir=`dirname $manual`
     48  1.1  christos   test $mandir = . && mandir=$initial_dir
     49  1.1  christos   manual_base=`basename "$manual" | sed 's/\.[^.]*$//'`
     50  1.1  christos   
     51  1.1  christos   rm -f $manual_base.* texinfo.tex
     52  1.1  christos   ln -s $newdir/texinfo.tex texinfo.tex
     53  1.1  christos 
     54  1.1  christos   if $full; then
     55  1.1  christos     # instead of comparing, do full test of just the new texinfo.tex.
     56  1.1  christos     echo "$0: testing $manual_base... (tex)"
     57  1.1  christos     texi2dvi $manual || { echo "texi2dvi $manual failed." >&2; exit 1; }
     58  1.1  christos     echo "$0: testing $manual_base... (pdf)"
     59  1.1  christos     texi2dvi --pdf $manual \
     60  1.1  christos     || { echo "texi2dvi --pdf $manual failed." >&2; exit 1; }
     61  1.1  christos    
     62  1.1  christos   else
     63  1.1  christos     echo "$0: testing $manual_base... (new)"
     64  1.1  christos     run_tex
     65  1.1  christos     dvips $manual_base -o || exit 1
     66  1.1  christos     mv $manual_base.ps new.$manual_base.ps
     67  1.1  christos 
     68  1.1  christos     echo "$0: testing $manual_base... (old)"
     69  1.1  christos     rm -f $manual_base.* texinfo.tex
     70  1.1  christos     ln -s $olddir/texinfo.tex texinfo.tex
     71  1.1  christos     run_tex
     72  1.1  christos     dvips $manual_base -o || exit 1
     73  1.1  christos     mv $manual_base.ps old.$manual_base.ps
     74  1.1  christos 
     75  1.1  christos     diff -U0 old.$manual_base.ps new.$manual_base.ps
     76  1.1  christos   fi
     77  1.1  christos done
     78