diff options
Diffstat (limited to 'Build/source/texk/web2c/ptexdir/wcfname.test')
-rwxr-xr-x | Build/source/texk/web2c/ptexdir/wcfname.test | 82 |
1 files changed, 65 insertions, 17 deletions
diff --git a/Build/source/texk/web2c/ptexdir/wcfname.test b/Build/source/texk/web2c/ptexdir/wcfname.test index 734ee3dd40e..e53866f61d4 100755 --- a/Build/source/texk/web2c/ptexdir/wcfname.test +++ b/Build/source/texk/web2c/ptexdir/wcfname.test @@ -3,13 +3,27 @@ # Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org> # You may freely use, modify and/or distribute this file. -test -d ptests || mkdir -p ptests -rm -f ptests/fn*.log ptests/fn*.txt ptests/fn*.tex fn*.tex +engine=ptex +testdir=ptests -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=; err3=; err4= TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF -TEXINPUTS=ptests:.; export TEXINPUTS +TEXINPUTS="$testdir;."; export TEXINPUTS + +$_kpsewhich -var-value=TEXMFCNF +$_kpsewhich -progname=$engine -var-value=TEXINPUTS +$_kpsewhich -progname=$engine -var-value=command_line_encoding +$_kpsewhich -progname=$engine -var-value=guess_input_kanji_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\$" @@ -29,21 +43,43 @@ if [ $ret != 0 ]; then LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE fi -perl $srcdir/tests/fn-generate.perl ptests +if [ "$COMSPEC" != "" ] || [ "$ExeExt" = ".exe" ]; then + echo "*** We guess OS is Windows." + MyOS=Windows + try_ienc="sjis" +else + echo "*** We guess OS is not Windows." + MyOS=nonWindows + try_ienc="euc sjis" +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 128 + exit 77 fi # pTeX internal encoding fenc="utf8" -for ienc in euc sjis; do +for ienc in $try_ienc; do for doc in fn-$fenc fnさざ波-$fenc; do echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc - ./ptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >ptests/$doc-$ienc-term.log || rc=1 - mv $doc-$ienc.txt $doc-$ienc.log ptests/ - diff ptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=2 + $_kpsewhich -progname=$engine $doc.tex || rc=10 + $_kpsewhich -progname=$engine fn±×÷§¶-utf8.tex || rc=11 + $_tex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >$testdir/$doc-$fenc-$ienc-term.log || \ + { rc=1 ; err1=$err1" $fenc:$ienc:$doc" ; } + $_kpsewhich -progname=$engine $doc-tmp.tex || rc=12 + $_kpsewhich -progname=$engine fn±×÷§¶-utf8-tmp.tex || rc=13 + mv $doc-$ienc.txt $doc-$ienc.log $testdir/ + diff $testdir/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || \ + { rc=2 ; err2=$err2" $fenc:$ienc:$doc" ; } + rm -f $testdir/fn±×÷§¶-utf8-tmp.tex done done @@ -59,21 +95,33 @@ for fenc in sjis euc; do for doc in fnさざ波-$fenc; do ienc=$fenc - if [ "$COMSPEC" != "" ]; then - echo "*** We guess OS is Windows." - if [ $fenc != euc ]; then ienc="sjis"; fi + if [ $MyOS = Windows ]; then + ienc="sjis" else - echo "*** We guess OS is not Windows." if [ $fenc != sjis ]; then ienc="euc"; fi fi echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc - ./ptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >ptests/$doc-$fenc-term.log || rc=3 - mv $doc-$ienc.txt $doc-$ienc.log ptests/ - diff ptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=4 + $_kpsewhich -progname=$engine $doc.tex || rc=20 + $_kpsewhich -progname=$engine fn±×÷§¶-utf8.tex || rc=21 + $_tex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >$testdir/$doc-$fenc-$ienc-term.log || \ + { rc=3 ; err3=$err3" $fenc:$ienc:$doc" ; } + $_kpsewhich -progname=$engine $doc-tmp.tex || rc=22 + $_kpsewhich -progname=$engine fn±×÷§¶-utf8-tmp.tex || rc=23 + mv $doc-$ienc.txt $doc-$ienc.log $testdir/ + diff $testdir/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || \ + { rc=4 ; err4=$err4" $fenc:$ienc:$doc" ; } done done +if [ $rc -gt 0 ]; then + if [ -n "$err1" ]; then echo ERROR1 $err1; fi + if [ -n "$err2" ]; then echo ERROR2 $err2; fi + if [ -n "$err3" ]; then echo ERROR3 $err3; fi + if [ -n "$err4" ]; then echo ERROR4 $err4; fi +else + echo PASS +fi exit $rc |