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