Skip to content

Commit

Permalink
xetex: Make easier to test on Windows
Browse files Browse the repository at this point in the history
git-svn-id: svn://tug.org/texlive/trunk/Build/source@67992 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
t-tk committed Aug 20, 2023
1 parent 02d3c45 commit 9c74339
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 21 deletions.
5 changes: 5 additions & 0 deletions texk/web2c/xetexdir/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2023-08-20 TANAKA Takuji <ttk@t-lab.opal.ne.jp>

* {wcfname,xetex-bug73,xetex-filedump,xetex}.test:
Make easier to test on Windows.

2023-03-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp>

* wcfname.test:
Expand Down
74 changes: 61 additions & 13 deletions texk/web2c/xetexdir/wcfname.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,84 @@
# Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.

test -d xetests || mkdir -p xetests
rm -f xetests/fn*.log xetests/fn*.txt xetests/fn*.tex fn*.tex
engine=xetex
testdir=xetests

rc=0
KpsDir=${KpsDir:-../kpathsea}
BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_kpsewhich=$KpsDir/kpsewhich$ExeExt
_tex=$BinDir/$engine$ExeExt

test -d $testdir || mkdir -p $testdir
rm -f $testdir/fn*.log $testdir/fn*.txt $testdir/fn*.tex fn*.tex

rc=0; err1=; err2=

TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
TEXINPUTS=xetests:.; export TEXINPUTS
TEXINPUTS="$testdir;."; export TEXINPUTS

perl $srcdir/tests/fn-generate.perl xetests
pret=$?
if [ $pret != 0 ] && [ $pret != 239 ]; then
exit 128
$_kpsewhich -var-value=TEXMFCNF
$_kpsewhich -progname=$engine -var-value=TEXINPUTS
$_kpsewhich -progname=$engine -var-value=command_line_encoding

for loc in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8 ja_JP.UTF-8 ja_JP.utf8; do
locale -a | grep "^$loc\$"
ret=$?
# For Slackware linux, we need to replace from utf8 to UTF-8
if [ -f /etc/slackware-version ]; then
loc=`echo $loc | sed -e "s/utf8/UTF-8/"`
fi
if [ $ret = 0 ]; then
LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
break
fi
done
if [ $ret != 0 ]; then
# linux musl fails to run `locale -a` but seems to have C.UTF-8
loc=C.UTF-8
LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
fi
rm -f xetests/fn*-euc.tex xetests/fn*-sjis.tex

if [ "$COMSPEC" != "" ]; then
if [ "$COMSPEC" != "" ] || [ "$ExeExt" = ".exe" ]; then
echo "*** We guess OS is Windows."
command_line_encoding=utf8
export command_line_encoding
fi
if [ "$ExeExt" = ".exe" ]; then
opt_win=-windows
else
opt_win=
fi

perl -s $srcdir/tests/fn-generate.perl $opt_win $testdir
pret=$?
if [ $pret != 0 ] && [ $pret != 239 ]; then
exit 77
fi
rm -f $testdir/fn*-euc.tex $testdir/fn*-sjis.tex

fenc="utf8"
for doc in fn-$fenc fn£¥µÆÇñß-$fenc fnさざ波-$fenc; do

echo '>>> Document:'$doc ' File Encoding:'$fenc
./xetex -ini -interaction nonstopmode -jobname=$doc --shell-escape $doc.tex >xetests/$doc-term.log || rc=1
mv $doc.txt $doc.log xetests/
diff xetests/$doc.txt $srcdir/tests/fn-utf8.txt || rc=2
$_kpsewhich -progname=$engine $doc.tex || rc=10
$_kpsewhich -progname=$engine fn±×÷§¶-utf8.tex || rc=11
$_tex -ini -interaction nonstopmode -jobname=$doc --shell-escape $doc.tex >$testdir/$doc-term.log || \
{ rc=1 ; err1=$err1" $fenc:$doc" ; }
$_kpsewhich -progname=$engine $doc-tmp.tex || rc=12
$_kpsewhich -progname=$engine fn±×÷§¶-utf8-tmp.tex || rc=13
mv $doc.txt $doc.log $testdir/
diff $testdir/$doc.txt $srcdir/tests/fn-utf8.txt || \
{ rc=2 ; err2=$err2" $fenc:$doc" ; }

done


if [ $rc -gt 0 ]; then
if [ -n "$err1" ]; then echo ERROR1 $err1; fi
if [ -n "$err2" ]; then echo ERROR2 $err2; fi
else
echo PASS
fi
exit $rc
12 changes: 8 additions & 4 deletions texk/web2c/xetexdir/xetex-bug73.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# Copyright 2014-2015 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_xetex=$BinDir/xetex$ExeExt

LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE

TEXMFCNF=$srcdir/../kpathsea;export TEXMFCNF
TEXINPUTS=.:$srcdir/tests; export TEXINPUTS
TEXINPUTS=".;$srcdir/tests"; export TEXINPUTS
TEXFORMATS=.; export TEXFORMATS

# get same filename in log
Expand All @@ -15,11 +19,11 @@ $LN_S $srcdir/xetexdir/tests/bug73.tex .

#exit 77

./xetex -ini bug73 || exit 1
$_xetex -ini bug73 || exit 1

./xetex -fmt=bug73 bug73 || exit 1
$_xetex -fmt=bug73 bug73 || exit 2

sed 1d bug73.log >bug73.out

diff $srcdir/xetexdir/tests/bug73.log bug73.out || exit 1
diff $srcdir/xetexdir/tests/bug73.log bug73.out || exit 3

10 changes: 7 additions & 3 deletions texk/web2c/xetexdir/xetex-filedump.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
# Copyright 2019 Karl Berry <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_xetex=$BinDir/xetex$ExeExt

LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE

TEXMFCNF=$srcdir/../kpathsea;export TEXMFCNF
TEXINPUTS=.:$srcdir/tests; export TEXINPUTS
TEXINPUTS=".;$srcdir/tests"; export TEXINPUTS
TEXFORMATS=.; export TEXFORMATS

# get same filename in log
Expand All @@ -14,9 +18,9 @@ $LN_S $srcdir/xetexdir/tests/filedump.tex .

#exit 77

./xetex -ini filedump || exit 1
$_xetex -ini filedump || exit 1

sed 1d filedump.log >filedump.out

diff $srcdir/xetexdir/tests/filedump.log filedump.out || exit 1
diff $srcdir/xetexdir/tests/filedump.log filedump.out || exit 2

6 changes: 5 additions & 1 deletion texk/web2c/xetexdir/xetex.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@

# Not really a test, just making sure the program executes.

./xetex -version || exit 1
BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_xetex=$BinDir/xetex$ExeExt

$_xetex -version || exit 1

0 comments on commit 9c74339

Please sign in to comment.