NetBSD/gnu/dist/texinfo/util/txitextest

78 lines
2.0 KiB
Bash

#!/bin/sh
# Id: txitextest,v 1.5 2004/04/11 17:56:47 karl Exp
# Test texinfo.tex changes by running various manuals through with an
# old version, saving the .ps result from dvips, doing the same with a
# new version, and comparing. Idea from Stepan Kasal.
#
# Another option is to run the manuals all the way through using
# texi2dvi, which tests in another way.
tsrc=/u/texinfo/src
PATH=$tsrc/util:$PATH
tdoc=$tsrc/doc
default_manuals="$tdoc/texinfo.txi $tdoc/info.texi $tdoc/info-stnd.texi"
olddir=$HOME/gnu/src/gnulib/config
newdir=$tdoc
tempdir=/u/texinfo/@tests/testdir
full=false
manuals=
while test $# -gt 0; do
case $1 in
--f*) full=true;;
--o*) shift; olddir="$1";;
--n*) shift; newdir="$1";;
--t*) shift; tempdir="$1";;
-*) echo "$0: unknown option \`$1'." >&2; exit 1;;
*) manuals="$manuals $1";;
esac
shift
done
test -z "$manuals" && manuals=$default_manuals
initial_dir=`pwd`
cd $tempdir || exit 1
rm -f *
run_tex() \
{
TEXINPUTS=.:$mandir: tex $manual \
|| { echo "tex $manual failed." >&2; exit 1; }
}
for manual in $manuals; do
mandir=`dirname $manual`
test $mandir = . && mandir=$initial_dir
manual_base=`basename "$manual" | sed 's/\.[^.]*$//'`
rm -f $manual_base.* texinfo.tex
ln -s $newdir/texinfo.tex texinfo.tex
if $full; then
# instead of comparing, do full test of just the new texinfo.tex.
echo "$0: testing $manual_base... (tex)"
texi2dvi $manual || { echo "texi2dvi $manual failed." >&2; exit 1; }
echo "$0: testing $manual_base... (pdf)"
texi2dvi --pdf $manual \
|| { echo "texi2dvi --pdf $manual failed." >&2; exit 1; }
else
echo "$0: testing $manual_base... (new)"
run_tex
dvips $manual_base -o || exit 1
mv $manual_base.ps new.$manual_base.ps
echo "$0: testing $manual_base... (old)"
rm -f $manual_base.* texinfo.tex
ln -s $olddir/texinfo.tex texinfo.tex
run_tex
dvips $manual_base -o || exit 1
mv $manual_base.ps old.$manual_base.ps
diff -U0 old.$manual_base.ps new.$manual_base.ps
fi
done