| 1 |
#! /bin/sh -vx |
| 2 |
# $Id: ptriptest.test 76016 2025-08-10 03:33:31Z takuji $ |
| 3 |
# Copyright 2023 Japanese TeX Development Community <[email protected]> |
| 4 |
# Copyright 2017-2018 Karl Berry <[email protected]> |
| 5 |
# Copyright 2010-2014 Peter Breitenlohner <[email protected]> |
| 6 |
# You may freely use, modify and/or distribute this file. |
| 7 |
|
| 8 |
W2CDir=${W2CDir:-..} |
| 9 |
ExeExt=${ExeExt:-} |
| 10 |
_uptex=$W2CDir/uptex$ExeExt |
| 11 |
_pltotf=$W2CDir/pltotf$ExeExt |
| 12 |
_tftopl=$W2CDir/tftopl$ExeExt |
| 13 |
_dvitype=$W2CDir/dvitype$ExeExt |
| 14 |
|
| 15 |
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE |
| 16 |
|
| 17 |
testdir=$abs_srcdir/triptrap |
| 18 |
uptestdir=$abs_srcdir/uptexdir/uptrip |
| 19 |
|
| 20 |
TEXMFCNF=$uptestdir; export TEXMFCNF |
| 21 |
|
| 22 |
rm -rf upptripdir |
| 23 |
mkdir upptripdir |
| 24 |
cd upptripdir |
| 25 |
mkdir -p a b |
| 26 |
|
| 27 |
# TeX Live generic |
| 28 |
cat >filter <<-\_EOF |
| 29 |
s,^\*\*(\./trip\.tex ##,** \&trip trip \ |
| 30 |
(trip.tex ##, |
| 31 |
s/ (TeX Live 20[^)]*)// |
| 32 |
s/ (Web2C 202[3-9][^)]*)// |
| 33 |
s/(preloaded format=.*tex)/(INITEX)/ |
| 34 |
s/format=trip [^)][^)]*)/format=trip)/ |
| 35 |
s/) [0-9A-Z: ]*$/)/ |
| 36 |
s,^(\./,(, |
| 37 |
s/[1-9][0-9]* strings out of [1-9].*/XX strings out of YYY/ |
| 38 |
s/[1-9][0-9]* string characters out of [1-9].*/XXX string characters out of YYYY/ |
| 39 |
s/sequences out of [1-9].*/sequences out of YYYY/ |
| 40 |
s/[1-9] hyphenation exceptions* out of [1-9].*/X hyphenation exceptions out of YYY/ |
| 41 |
s/[1-9][0-9]* strings of total length [1-9].*/XXXX strings of total length YYYYY/ |
| 42 |
s/9 ops out of [1-9][0-9]*/9 ops out of YYY/ |
| 43 |
s/TeX output ....\...\...:..../TeX output YYYY.MM.DD:hhmm/ |
| 44 |
_EOF |
| 45 |
|
| 46 |
# x86 glue rounding |
| 47 |
cat >>filter <<-\_EOF |
| 48 |
s/ 16341\.999.*fil/ 16342.0fil/ |
| 49 |
s/ 16238\.999.*fil/ 16239.0fil/ |
| 50 |
s/ 16317\.999.*fil/ 16318.0fil/ |
| 51 |
s/ 16330\.999.*fil/ 16331.0fil/ |
| 52 |
s/ 16331\.999.*fil/ 16332.0fil/ |
| 53 |
s/ 16343\.999.*fil/ 16344.0fil/ |
| 54 |
s/ 9737\.587..fil/ 9737.58789fil/ |
| 55 |
s/down4 639342.../down4 639342208/ |
| 56 |
s/y4 2039217../y4 203921760/ |
| 57 |
s/y0 2039217../y0 203921760/ |
| 58 |
_EOF |
| 59 |
|
| 60 |
# pTeX |
| 61 |
cat >>filter <<-\_EOF |
| 62 |
s/This is .*TeX,/This is *TeX,/ |
| 63 |
s/ (utf8[^)]*)/ / |
| 64 |
s/ Version 3\.141592653-[^ ]* / Version 3.141592653/ |
| 65 |
s/ before: [1-9][0-9][0-9][0-9]*&[1-9][0-9][0-9][0-9]*; / before: XXX\&YYY; / |
| 66 |
s/ after: [1-9][0-9][0-9][0-9]*&[1-9][0-9][0-9][0-9]*; / after: XXX\&YYY; / |
| 67 |
s/ still untouched: [1-9][0-9][0-9][0-9]*/ still untouched: XXX/ |
| 68 |
_EOF |
| 69 |
|
| 70 |
dvitype_args="-output-level=2 -dpi=72.27 -page-start='*.*.*.*.*.*.*.*.*.*'" |
| 71 |
|
| 72 |
echo ">>> Running TRIP test for upTeX-euc." >&2 |
| 73 |
echo ">>> See $uptestdir/ptrip.diffs for example of acceptable diffs." >&2 |
| 74 |
|
| 75 |
# pTeX outputs direction of boxes. |
| 76 |
P_SED1='s/, yoko direction//;s/yoko direction, //' |
| 77 |
P_SED2='s/yoko(math) direction, //' |
| 78 |
|
| 79 |
is_OK=: |
| 80 |
|
| 81 |
set -x |
| 82 |
|
| 83 |
echo "*** TRIP test for upTeX-euc ***." |
| 84 |
|
| 85 |
$_pltotf $testdir/trip.pl trip.tfm || exit 1 |
| 86 |
|
| 87 |
$_tftopl ./trip.tfm trip.pl || exit 1 |
| 88 |
|
| 89 |
diff $testdir/trip.pl trip.pl || is_OK=false |
| 90 |
|
| 91 |
# get same filename in log |
| 92 |
$LN_S $testdir/trip.tex . |
| 93 |
|
| 94 |
rm -f trip.log |
| 95 |
$_uptex --kanji-internal=euc --progname=pinitex --ini <$testdir/trip1.in >ptripin.fot |
| 96 |
if test ! -s trip.fmt; then |
| 97 |
echo "*** trip.fmt not created by trip1.in, investigate!" >&2 |
| 98 |
exit 1 |
| 99 |
fi |
| 100 |
sed "$P_SED1" trip.log > ptripin.log || exit 1 |
| 101 |
$DIFF $testdir/tripin.log ptripin.log |
| 102 |
|
| 103 |
# May as well test non-ini second time through. |
| 104 |
rm -f trip.log |
| 105 |
$_uptex --kanji-internal=euc --progname=ptex <$testdir/trip2.in >ptrip.fot |
| 106 |
sed "$P_SED1;$P_SED2" trip.log > ptrip.log |
| 107 |
#diff $testdir/trip.fot ptrip.fot |
| 108 |
|
| 109 |
# We use $DIFF instead of `diff' only for those files where there |
| 110 |
# might actually be legitimate numerical differences. |
| 111 |
$DIFF $DIFFFLAGS $testdir/trip.log ptrip.log |
| 112 |
|
| 113 |
mv tripos.tex ptripos.tex |
| 114 |
diff $testdir/tripos.tex ptripos.tex || is_OK=false |
| 115 |
|
| 116 |
eval $_dvitype $dvitype_args trip.dvi >ptrip.typ || exit 1 |
| 117 |
#$DIFF $DIFFFLAGS $testdir/trip.typ ptrip.typ |
| 118 |
|
| 119 |
for f in trip.fot trip.typ; do |
| 120 |
sed -f filter $testdir/$f >a/$f |
| 121 |
sed -f filter p$f >b/$f |
| 122 |
diff a/$f b/$f || is_OK=false |
| 123 |
done |
| 124 |
|
| 125 |
$is_OK || { |
| 126 |
echo ">>> There were some errors." >&2 |
| 127 |
exit 1 |
| 128 |
} |
| 129 |
|