3 # This file is part of the validate package.
4 # ------------------------------------------
6 # Checks a .tlg file against the .log file created by TeX from the test
8 # A test file must have the extension .lvt
11 # usage: checktlg <fmt name> <test file base> [translation table]
14 # check number of args and set format etc.
16 if [ $# -lt 2 -o $# -gt 3 ] ; then
17 echo >&2 Usage
: checktlg format
file [translation_table
]
24 TRANSLATE
="--translate-file=$3"
26 LATEX
="etex $TRANSLATE -efmt=`dirname $1`/`basename $1 .fmt`"
27 BASE
=`basename $2 .lvt`
34 # remove all kind of rubbish
36 rm -f $BASE.log
$BASE.au?
$BASE.tmp.tlg
$TLG_BASE.tlg.
diff $BASE.dvi
37 rm -f $BASE.lvt.log
$BASE.lvt.au?
$BASE.lvt.dvi
$TLG_BASE.mod.tlg
38 rm -f $BASE.glo
$BASE.idx
$BASE.lof
$BASE.toc
$BASE.lot
39 rm -f $BASE.lvt.glo
$BASE.lvt.idx
$BASE.lvt.lof
$BASE.lvt.toc
$BASE.lvt.lot
42 echo -n Checking
$BASE...
43 # run TeX twice with chosen format
46 ( yes "" |
$LATEX $BASE.lvt
> /dev
/null
2>&1 ) 2>/dev
/null
47 ( yes "" |
$LATEX $BASE.lvt
> /dev
/null
2>&1 ) 2>/dev
/null
49 if test -r $BASE.lvt.log
; then LOG
=$BASE.lvt.log
; else LOG
=$BASE.log
; fi
51 # remove stuff from the log which is of no interest and save the result
54 #sed -e "1,/START-TEST-LOG/d" \
55 # -e "/END-TEST-LOG/,//d" \
56 # -e "/OMIT/,/TIMO/d" \
58 # ${BEFORE_SED_SCRIPTS} \
59 # -e "/([^ ]*fd/,/^[ ]*)/d" \
60 # -e "\![^<][0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]!d" \
61 # ${AFTER_SED_SCRIPTS} \
62 # $LOG > $BASE.tmp.tlg
63 perl
`dirname $0`/log2tlg
$BASE < $LOG > $BASE.tmp.tlg
65 # remove empty lines from .tlg file
66 perl
-n -e '/^\s*$/ || print' < $TLG_BASE.tlg
>$TLG_BASE.mod.tlg
70 ##if (cmp -s $TLG_BASE.mod.tlg $BASE.tmp.tlg)
72 # use diff to allow stripping of trailing CR when using across Windows + Unix
74 if (diff -q --strip-trailing-cr $TLG_BASE.mod.tlg
$BASE.tmp.tlg
)
76 # echo Check passed for $BASE
78 rm -f $BASE.log
$BASE.au?
$BASE.tmp.tlg
$TLG_BASE.tlg.
diff $BASE.dvi
79 rm -f $BASE.glo
$BASE.idx
$BASE.lof
$BASE.toc
$BASE.lot
$TLG_BASE.mod.tlg
82 # echo '***************************************************************'
83 # echo '*' Check not passed! Preparing context diff in $TLG_BASE.tlg.diff
84 # echo '***************************************************************'
85 # echo done with $TLG_BASE.tlg.diff
86 echo ' ***** NOT PASSED ***** see:' $TLG_BASE.tlg.
diff
88 # strip CR in comparison
89 diff --strip-trailing-cr -c $TLG_BASE.mod.tlg
$BASE.tmp.tlg
> $TLG_BASE.tlg.
diff