summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/texinfo/util/txitextest
blob: afd2521ebd02be5aab13fddd4ed1019fee8b32c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
# $Id: txitextest,v 1.1.1.1 2006/07/17 16:03:51 espie 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