| 1 |
#! /bin/sh -vx |
| 2 |
# $Id: mftraptest.test 70943 2024-04-14 05:29:13Z takuji $ |
| 3 |
# Copyright 2017-2021 Karl Berry <[email protected]> |
| 4 |
# Copyright 2009-2014 Peter Breitenlohner <[email protected]> |
| 5 |
# You may freely use, modify and/or distribute this file. |
| 6 |
|
| 7 |
W2CDir=${W2CDir:-..} |
| 8 |
ExeExt=${ExeExt:-} |
| 9 |
_mf=$W2CDir/mf$ExeExt |
| 10 |
_tftopl=$W2CDir/tftopl$ExeExt |
| 11 |
_gftype=$W2CDir/gftype$ExeExt |
| 12 |
|
| 13 |
# pre-generated test results in the repository are stored in LF |
| 14 |
# but the output might be written in CRLF on some platform. |
| 15 |
# if 'diff --strip-trailing-cr' is available, exploit it. |
| 16 |
# (useful for tests on win32 binaries run on MSYS shell) |
| 17 |
DIFF="diff" |
| 18 |
$DIFF --strip-trailing-cr $0 $0 \ |
| 19 |
&& DIFF="diff --strip-trailing-cr" || echo |
| 20 |
|
| 21 |
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE |
| 22 |
|
| 23 |
testdir=$abs_srcdir/triptrap |
| 24 |
TEXMFCNF=$testdir; export TEXMFCNF |
| 25 |
|
| 26 |
rm -rf trapdir |
| 27 |
mkdir trapdir |
| 28 |
cd trapdir |
| 29 |
mkdir a b |
| 30 |
|
| 31 |
# See triptrap/README for explanation of why we believe these diffs are ok, |
| 32 |
# notably including the capsule numbers. |
| 33 |
|
| 34 |
# TeX Live generic |
| 35 |
cat >filter <<-\_EOF |
| 36 |
s,^\*\*(trap\.mf,** \&trap trap \ |
| 37 |
(trap.mf, |
| 38 |
s/ (TeX Live 20[^)]*)// |
| 39 |
s/ (Web2C 202[3-9][^)]*)// |
| 40 |
s/base=trap [^)][^)]*)/base=trap)/ |
| 41 |
s/) [0-9A-Z: ]*$/)/ |
| 42 |
s/usage [1-9][0-9&]* ([1-9][0-9&]* still/usage XX\&XX (YYY\&YYYYY still/ |
| 43 |
s/[1-9][0-9]* strings of total length [1-9][0-9]*/XXXX strings of total length YYYYY/ |
| 44 |
s/[1-9][0-9]* strings out of [1-9].*/XX strings out of YYY/ |
| 45 |
s/[1-9][0-9]* string characters out of [1-9].*/XXXX string characters out of YYYYY/ |
| 46 |
s/tokens out of [1-9][0-9]*/tokens out of YYYY/ |
| 47 |
s/out of [1-9][0-9]*i,[0-9nrpb,]*/out of YYi,YYYn,YYYr,YYYp,YYYb/ |
| 48 |
s/out of [1-9][0-9]*w,[0-9hdilkep,]*)/out of YYYw,YYh,YYd,YYi,YYYYl,YYYk,YYYe,YYp)/ |
| 49 |
s/METAFONT output ....\...\...:..../METAFONT output YYYY.MM.DD:hhmm/ |
| 50 |
_EOF |
| 51 |
|
| 52 |
# Capsule numbers |
| 53 |
cat >>filter <<-\_EOF |
| 54 |
s/ %CA$/ %/ |
| 55 |
s/^PSULE1675/CAPSULE1172/ |
| 56 |
s/%CAPSULE[1-9][0-9]*/%CAPSULEnnnn/g |
| 57 |
_EOF |
| 58 |
|
| 59 |
echo ">>> Running TRAP test for Metafont." >&2 |
| 60 |
echo ">>> See $testdir/mftrap.diffs for example of acceptable diffs." >&2 |
| 61 |
|
| 62 |
is_OK=: |
| 63 |
|
| 64 |
set -x |
| 65 |
|
| 66 |
# get same filename in log |
| 67 |
rm -f trap.mf |
| 68 |
$LN_S $testdir/trap.mf . || exit 1 |
| 69 |
|
| 70 |
rm -f trap.base |
| 71 |
$_mf --progname=inimf <$testdir/mftrap1.in >mftrapin.fot |
| 72 |
if test ! -s trap.base; then |
| 73 |
echo "*** trap.base not created by mftrap1.in, investigate!" >&2 |
| 74 |
exit 1 |
| 75 |
fi |
| 76 |
mv trap.log mftrapin.log || exit 1 |
| 77 |
diff $testdir/mftrapin.log mftrapin.log |
| 78 |
|
| 79 |
$_mf --progname=inimf <$testdir/mftrap2.in >mftrap.fot |
| 80 |
mv trap.log mftrap.log || exit 1 |
| 81 |
mv trap.tfm mftrap.tfm || exit 1 |
| 82 |
diff $testdir/mftrap.fot mftrap.fot |
| 83 |
diff $testdir/mftrap.log mftrap.log |
| 84 |
|
| 85 |
$_tftopl ./mftrap.tfm mftrap.pl || exit 1 |
| 86 |
diff $testdir/mftrap.pl mftrap.pl || is_OK=false |
| 87 |
|
| 88 |
$_gftype -m -i ./trap.72270gf >trap.typ || exit 1 |
| 89 |
$DIFF $testdir/trap.typ trap.typ |
| 90 |
|
| 91 |
for f in mftrapin.log mftrap.fot mftrap.log trap.typ; do |
| 92 |
sed -f filter $testdir/$f >a/$f |
| 93 |
sed -f filter $f >b/$f |
| 94 |
diff a/$f b/$f || is_OK=false |
| 95 |
done |
| 96 |
|
| 97 |
$is_OK && { |
| 98 |
echo ">>> All differences are acceptable." >&2 |
| 99 |
} || { |
| 100 |
echo "*** Error(s) found in mf trap test, investigate!" >&2 |
| 101 |
exit 1 |
| 102 |
} |