| 1 |
#! /bin/sh -vx |
| 2 |
# $Id: dtl.test 68030 2023-08-23 14:53:06Z takuji $ |
| 3 |
# Copyright 2017 Karl Berry <[email protected]> |
| 4 |
# Copyright 2009 Peter Breitenlohner <[email protected]> |
| 5 |
# You may freely use, modify and/or distribute this file. |
| 6 |
|
| 7 |
BinDir=${BinDir:-.} |
| 8 |
ExeExt=${ExeExt:-} |
| 9 |
_dt2dv=$BinDir/dt2dv$ExeExt |
| 10 |
_dv2dt=$BinDir/dv2dt$ExeExt |
| 11 |
|
| 12 |
# pre-generated test results in the repository are stored in LF |
| 13 |
# but the output might be written in CRLF on some platform. |
| 14 |
# if 'diff --strip-trailing-cr' is available, exploit it. |
| 15 |
# (useful for tests on win32 binaries run on MSYS shell) |
| 16 |
DIFF="diff" |
| 17 |
$DIFF --strip-trailing-cr $0 $0 \ |
| 18 |
&& DIFF="diff --strip-trailing-cr" || echo |
| 19 |
|
| 20 |
# check whether the binaries are Windows exe or not |
| 21 |
run_stdio_test=${run_stdio_test:-1} |
| 22 |
if [ "$ExeExt" = ".exe" ]; then |
| 23 |
echo "*** We assume EXE on Windows." |
| 24 |
run_stdio_test=0 |
| 25 |
fi |
| 26 |
|
| 27 |
rc=0 |
| 28 |
|
| 29 |
$_dt2dv $srcdir/edited.txt testfile.dvi || rc=1 |
| 30 |
|
| 31 |
$_dv2dt testfile.dvi testfile.dtl || rc=2 |
| 32 |
|
| 33 |
$_dt2dv testfile.dtl testfile.dvx || rc=3 |
| 34 |
|
| 35 |
$_dv2dt testfile.dvx testfile.dtx || rc=4 |
| 36 |
|
| 37 |
cmp testfile.dvi testfile.dvx || rc=5 |
| 38 |
|
| 39 |
diff testfile.dtl testfile.dtx || rc=6 |
| 40 |
|
| 41 |
$_dt2dv -so testfile.dtl > testfile1.dvi || rc=7 |
| 42 |
$_dt2dv -si testfile2.dvi < testfile.dtl || rc=8 |
| 43 |
$_dt2dv -so -si < testfile.dtl > testfile3.dvi || rc=9 |
| 44 |
|
| 45 |
cmp testfile.dvi testfile1.dvi || rc=10 |
| 46 |
cmp testfile.dvi testfile2.dvi || rc=11 |
| 47 |
cmp testfile.dvi testfile3.dvi || rc=12 |
| 48 |
|
| 49 |
if [ "$run_stdio_test" -gt 0 ]; then |
| 50 |
|
| 51 |
$_dv2dt < testfile.dvi > testfile1.dtl || rc=13 |
| 52 |
cat testfile.dvi | $_dv2dt > testfile2.dtl || rc=14 |
| 53 |
|
| 54 |
$DIFF testfile.dtl testfile1.dtl || rc=15 |
| 55 |
$DIFF testfile.dtl testfile2.dtl || rc=16 |
| 56 |
|
| 57 |
else |
| 58 |
|
| 59 |
echo dti with stdin and stdout tests **SKIPPED** |
| 60 |
|
| 61 |
fi |
| 62 |
|
| 63 |
exit $rc |