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
10tsrc=/u/texinfo/src
11PATH=$tsrc/util:$PATH
12
13tdoc=$tsrc/doc
14default_manuals="$tdoc/texinfo.txi $tdoc/info.texi $tdoc/info-stnd.texi"
15
16olddir=$HOME/gnu/src/gnulib/config
17newdir=$tdoc
18tempdir=/u/texinfo/@tests/testdir
19full=false
20manuals=
21
22while 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
32done
33
34test -z "$manuals" && manuals=$default_manuals
35initial_dir=`pwd`
36
37cd $tempdir || exit 1
38rm -f *
39
40run_tex() \
41{
42  TEXINPUTS=.:$mandir: tex $manual \
43  || { echo "tex $manual failed." >&2; exit 1; }
44}
45
46for 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
77done
78