summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/euptexdir
diff options
context:
space:
mode:
authorTakuji Tanaka <ttk@t-lab.opal.ne.jp>2023-08-20 14:26:56 +0000
committerTakuji Tanaka <ttk@t-lab.opal.ne.jp>2023-08-20 14:26:56 +0000
commitbb71bbacb80842b9b3b2e65484493437222f7f34 (patch)
treeb265db45eb108b13b1ce7c6fa3df0fd8a7d90e19 /Build/source/texk/web2c/euptexdir
parentf5a9767f0c69c3e2d9f6c557b14d65bf2cfea1b1 (diff)
{,e}{,u}ptex: Make easier to test on Windows
git-svn-id: svn://tug.org/texlive/trunk@67990 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/euptexdir')
-rw-r--r--Build/source/texk/web2c/euptexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/euptexdir/am/euptex.am4
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/eptriptest.test33
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/euptriptest.test17
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/eupver.test12
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/pdfprimitive.test6
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/wcfname.test101
-rwxr-xr-xBuild/source/texk/web2c/euptexdir/wcfname0.test136
8 files changed, 240 insertions, 75 deletions
diff --git a/Build/source/texk/web2c/euptexdir/ChangeLog b/Build/source/texk/web2c/euptexdir/ChangeLog
index 991a051add5..265a1c1ec61 100644
--- a/Build/source/texk/web2c/euptexdir/ChangeLog
+++ b/Build/source/texk/web2c/euptexdir/ChangeLog
@@ -1,3 +1,9 @@
+2023-08-20 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * am/euptex.am, {eptriptest,euptriptest,eupver,
+ pdfprimitive,wcfname,wcfname0}.test:
+ Make easier to test on Windows.
+
2023-03-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* wcfname.test:
diff --git a/Build/source/texk/web2c/euptexdir/am/euptex.am b/Build/source/texk/web2c/euptexdir/am/euptex.am
index d9f16c93194..5d86f392371 100644
--- a/Build/source/texk/web2c/euptexdir/am/euptex.am
+++ b/Build/source/texk/web2c/euptexdir/am/euptex.am
@@ -93,10 +93,10 @@ EXTRA_DIST += \
# e-upTeX Tests
#
-euptex_tests = euptexdir/euptriptest.test euptexdir/eptriptest.test euptexdir/pdfprimitive.test euptexdir/eupver.test euptexdir/wcfname.test
+euptex_tests = euptexdir/euptriptest.test euptexdir/eptriptest.test euptexdir/pdfprimitive.test euptexdir/eupver.test euptexdir/wcfname.test euptexdir/wcfname0.test
euptexdir/euptriptest.log euptexdir/eptriptest.log: euptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
euptexdir/pdfprimitive.log: euptex$(EXEEXT)
-euptexdir/eupver.log euptexdir/wcfname.log: euptex$(EXEEXT)
+euptexdir/eupver.log euptexdir/wcfname.log euptexdir/wcfname0.log: euptex$(EXEEXT)
EXTRA_DIST += $(euptex_tests)
diff --git a/Build/source/texk/web2c/euptexdir/eptriptest.test b/Build/source/texk/web2c/euptexdir/eptriptest.test
index 5ea5510f7a6..b737b7e2de7 100755
--- a/Build/source/texk/web2c/euptexdir/eptriptest.test
+++ b/Build/source/texk/web2c/euptexdir/eptriptest.test
@@ -6,6 +6,13 @@
# Copyright 2010 Hironori Kitagawa <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
+BinDir=${BinDir:-..}
+ExeExt=${ExeExt:-}
+_euptex=$BinDir/euptex$ExeExt
+_pltotf=$BinDir/pltotf$ExeExt
+_tftopl=$BinDir/tftopl$ExeExt
+_dvitype=$BinDir/dvitype$ExeExt
+
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
testdir=$abs_srcdir/triptrap
@@ -33,9 +40,9 @@ set -x
echo "*** TRIP test for e-pTeX in compatibility mode ***."
-../pltotf $testdir/trip.pl trip.tfm || exit 1
+$_pltotf $testdir/trip.pl trip.tfm || exit 1
-../tftopl ./trip.tfm trip.pl || exit 1
+$_tftopl ./trip.tfm trip.pl || exit 1
diff $testdir/trip.pl trip.pl || is_OK=false
@@ -43,7 +50,7 @@ diff $testdir/trip.pl trip.pl || is_OK=false
$LN_S $testdir/trip.tex .
rm -f trip.log
-../euptex --kanji-internal=euc --progname=epinitex --ini <$testdir/trip1.in >cptripin.fot
+$_euptex --kanji-internal=euc --progname=epinitex --ini <$testdir/trip1.in >cptripin.fot
if test ! -s trip.fmt; then
echo "*** trip.fmt not created by trip1.in, investigate!" >&2
exit 1
@@ -53,7 +60,7 @@ diff $testdir/tripin.log cptripin.log
# May as well test non-ini second time through.
rm -f trip.log
-../euptex --kanji-internal=euc --progname=eptex <$testdir/trip2.in >cptrip.fot
+$_euptex --kanji-internal=euc --progname=eptex <$testdir/trip2.in >cptrip.fot
sed "$P_SED1;$P_SED2" trip.log > cptrip.log
diff $testdir/trip.fot cptrip.fot
@@ -64,7 +71,7 @@ $DIFF $DIFFFLAGS $testdir/trip.log cptrip.log
mv tripos.tex cptripos.tex
diff $testdir/tripos.tex cptripos.tex
-eval ../dvitype $dvitype_args trip.dvi >cptrip.typ || exit 1
+eval $_dvitype $dvitype_args trip.dvi >cptrip.typ || exit 1
$DIFF $DIFFFLAGS $testdir/trip.typ cptrip.typ
mv trip.fmt ctrip.fmt
@@ -74,7 +81,7 @@ mv trip.fmt ctrip.fmt
echo "*** TRIP test for e-pTeX in extended mode ***."
rm -f trip.log
-../euptex --kanji-internal=euc --progname=epinitex --ini <$etestdir/etrip1.in >xptripin.fot
+$_euptex --kanji-internal=euc --progname=epinitex --ini <$etestdir/etrip1.in >xptripin.fot
if test ! -s trip.fmt; then
echo "*** trip.fmt not created by etrip1.in, investigate!" >&2
exit 1
@@ -84,7 +91,7 @@ diff $testdir/tripin.log xptripin.log
# May as well test non-ini second time through.
rm -f trip.log
-../euptex --kanji-internal=euc --progname=eptex <$etestdir/trip2.in >xptrip.fot
+$_euptex --kanji-internal=euc --progname=eptex <$etestdir/trip2.in >xptrip.fot
sed "$P_SED1;$P_SED2" trip.log > xptrip.log
diff $testdir/trip.fot xptrip.fot
@@ -95,7 +102,7 @@ $DIFF $DIFFFLAGS $testdir/trip.log xptrip.log
mv tripos.tex xptripos.tex
diff $testdir/tripos.tex xptripos.tex
-eval ../dvitype $dvitype_args trip.dvi >xptrip.typ || exit 1
+eval $_dvitype $dvitype_args trip.dvi >xptrip.typ || exit 1
$DIFF $DIFFFLAGS $testdir/trip.typ xptrip.typ
mv trip.fmt xtrip.fmt
@@ -104,16 +111,16 @@ mv trip.fmt xtrip.fmt
echo "*** e-TeX specific part of e-TRIP test for e-pTeX ***."
-../pltotf $etestdir/etrip.pl etrip.tfm || exit 1
+$_pltotf $etestdir/etrip.pl etrip.tfm || exit 1
-../tftopl ./etrip.tfm etrip.pl || exit 1
+$_tftopl ./etrip.tfm etrip.pl || exit 1
diff $etestdir/etrip.pl etrip.pl || is_OK=false
# get same filename in log
$LN_S $eptestdir/eptrip.tex etrip.tex
-../euptex --kanji-internal=euc --progname=epinitex --ini <$etestdir/etrip2.in >eptripin.fot
+$_euptex --kanji-internal=euc --progname=epinitex --ini <$etestdir/etrip2.in >eptripin.fot
if test ! -s etrip.fmt; then
echo "*** etrip.fmt not created by etrip2.in, investigate!" >&2
exit 1
@@ -122,7 +129,7 @@ sed "$P_SED1" etrip.log > eptripin.log || exit 1
diff $etestdir/etripin.log eptripin.log
# May as well test non-ini second time through.
-../euptex --kanji-internal=euc --progname=eptex <$etestdir/etrip3.in >eptrip.fot
+$_euptex --kanji-internal=euc --progname=eptex <$etestdir/etrip3.in >eptrip.fot
sed "$P_SED1;$P_SED2" etrip.log > eptrip.log
diff $etestdir/etrip.fot eptrip.fot
@@ -133,7 +140,7 @@ $DIFF $DIFFFLAGS $eptestdir/eptrip.log eptrip.log
mv etrip.out eptrip.out
diff $etestdir/etrip.out eptrip.out
-eval ../dvitype $dvitype_args etrip.dvi >eptrip.typ || exit 1
+eval $_dvitype $dvitype_args etrip.dvi >eptrip.typ || exit 1
$DIFF $DIFFFLAGS $etestdir/etrip.typ eptrip.typ
$is_OK || {
diff --git a/Build/source/texk/web2c/euptexdir/euptriptest.test b/Build/source/texk/web2c/euptexdir/euptriptest.test
index 8ea344bf822..91d0a6af7b3 100755
--- a/Build/source/texk/web2c/euptexdir/euptriptest.test
+++ b/Build/source/texk/web2c/euptexdir/euptriptest.test
@@ -5,6 +5,13 @@
# Copyright 2010 Hironori Kitagawa <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
+BinDir=${BinDir:-..}
+ExeExt=${ExeExt:-}
+_euptex=$BinDir/euptex$ExeExt
+_pltotf=$BinDir/pltotf$ExeExt
+_tftopl=$BinDir/tftopl$ExeExt
+_dvitype=$BinDir/dvitype$ExeExt
+
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
testdir=$abs_srcdir/triptrap
@@ -104,16 +111,16 @@ mv trip.fmt xtrip.fmt
echo "*** e-TeX specific part of e-TRIP test for e-upTeX ***."
-../pltotf $etestdir/etrip.pl etrip.tfm || exit 1
+$_pltotf $etestdir/etrip.pl etrip.tfm || exit 1
-../tftopl ./etrip.tfm etrip.pl || exit 1
+$_tftopl ./etrip.tfm etrip.pl || exit 1
diff $etestdir/etrip.pl etrip.pl || is_OK=false
# get same filename in log
$LN_S $eptestdir/eptrip.tex etrip.tex
-../euptex --progname=eupinitex --ini <$etestdir/etrip2.in >euptripin.fot
+$_euptex --progname=eupinitex --ini <$etestdir/etrip2.in >euptripin.fot
if test ! -s etrip.fmt; then
echo "*** etrip.fmt not created by etrip2.in, investigate!" >&2
exit 1
@@ -122,7 +129,7 @@ sed "$P_SED1" etrip.log > euptripin.log || exit 1
diff $etestdir/etripin.log euptripin.log
# May as well test non-ini second time through.
-../euptex --progname=euptex <$etestdir/etrip3.in >euptrip.fot
+$_euptex --progname=euptex <$etestdir/etrip3.in >euptrip.fot
sed "$P_SED1;$P_SED2" etrip.log > euptrip.log
diff $etestdir/etrip.fot euptrip.fot
@@ -133,7 +140,7 @@ $DIFF $DIFFFLAGS $eptestdir/eptrip.log euptrip.log
mv etrip.out euptrip.out
diff $etestdir/etrip.out euptrip.out
-eval ../dvitype $dvitype_args etrip.dvi >euptrip.typ || exit 1
+eval $_dvitype $dvitype_args etrip.dvi >euptrip.typ || exit 1
$DIFF $DIFFFLAGS $etestdir/etrip.typ euptrip.typ
$is_OK || {
diff --git a/Build/source/texk/web2c/euptexdir/eupver.test b/Build/source/texk/web2c/euptexdir/eupver.test
index c2a9281618e..30e1d15b864 100755
--- a/Build/source/texk/web2c/euptexdir/eupver.test
+++ b/Build/source/texk/web2c/euptexdir/eupver.test
@@ -3,13 +3,17 @@
# Copyright 2019 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
# You may freely use, modify and/or distribute this file.
+BinDir=${BinDir:-.}
+ExeExt=${ExeExt:-}
+_euptex=$BinDir/euptex$ExeExt
+
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
-TEXINPUTS=$srcdir/ptexdir/tests:.; export TEXINPUTS
+TEXINPUTS="$srcdir/ptexdir/tests;."; export TEXINPUTS
# check consistency between runtime terminal and log
-./euptex -ini -etex -interaction batchmode -jobname eupver1-log pver1.tex >eupver1-term.log || exit 1
+$_euptex -ini -etex -interaction batchmode -jobname eupver1-log pver1.tex >eupver1-term.log || exit 1
sed -n 's/^This is \([-A-Za-z]*\), Version [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
eupver1-term.log >eupver1-term_ed.log || exit 1
sed -n 's/^This is \([-A-Za-z]*\), Version [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
@@ -17,13 +21,13 @@ sed -n 's/^This is \([-A-Za-z]*\), Version [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
diff eupver1-term_ed.log eupver1-log_ed.log || exit 2
# check consistency between runtime and version output
-./euptex -version >eupver2-self.log || exit 1
+$_euptex -version >eupver2-self.log || exit 1
sed -n '1 s/^\([-A-Za-z]*\) [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
eupver2-self.log >eupver2-self_ed.log || exit 1
diff eupver1-term_ed.log eupver2-self_ed.log || exit 4
# check consistency between version output and version primitives
-./euptex -ini -etex -interaction batchmode -jobname eupver2-prim pver2.tex || exit 1
+$_euptex -ini -etex -interaction batchmode -jobname eupver2-prim pver2.tex || exit 1
sed -n 's/^Engine \([-A-Za-z]*\) \([^ ]*\) \(.*\)/\1 \2/p' \
eupver2-prim.log >eupver2-prim_ed.log || exit 1
diff eupver2-self_ed.log eupver2-prim_ed.log || exit 8
diff --git a/Build/source/texk/web2c/euptexdir/pdfprimitive.test b/Build/source/texk/web2c/euptexdir/pdfprimitive.test
index 8c3f0bfaffa..0f3ee9808a0 100755
--- a/Build/source/texk/web2c/euptexdir/pdfprimitive.test
+++ b/Build/source/texk/web2c/euptexdir/pdfprimitive.test
@@ -4,6 +4,10 @@
# Copyright 2015 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
+BinDir=${BinDir:-.}
+ExeExt=${ExeExt:-}
+_euptex=$BinDir/euptex$ExeExt
+
LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
@@ -15,7 +19,7 @@ FILE=pdfprimitive-euptex
rm -f $FILE.*
$LN_S $srcdir/eptexdir/tests/pdfprimitive-test.tex $FILE.tex
-./euptex -ini -etex $FILE && exit 1
+$_euptex -ini -etex $FILE && exit 1
sed 1d $FILE.log >$FILE.out
diff --git a/Build/source/texk/web2c/euptexdir/wcfname.test b/Build/source/texk/web2c/euptexdir/wcfname.test
index a6952999edd..acfbddf0d34 100755
--- a/Build/source/texk/web2c/euptexdir/wcfname.test
+++ b/Build/source/texk/web2c/euptexdir/wcfname.test
@@ -3,17 +3,32 @@
# Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.
-test -d euptests || mkdir -p euptests
-rm -f euptests/fn*.log euptests/fn*.txt euptests/fn*.tex fn*.tex
+engine=euptex
+testdir=euptests
-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=euptests:.; 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\$"
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
@@ -28,54 +43,35 @@ if [ $ret != 0 ]; then
LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
fi
-perl $srcdir/tests/fn-generate.perl euptests
+if [ "$COMSPEC" != "" ] || [ "$ExeExt" = ".exe" ]; then
+ echo "*** We guess OS is Windows."
+ MyOS=Windows
+else
+ echo "*** We guess OS is not Windows."
+ MyOS=nonWindows
+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
# upTeX internal encoding
fenc="utf8"
-for ienc in euc sjis uptex; do
+for ienc in uptex; do
for doc in fn-$fenc fnさざ波-$fenc fn£¥µÆÇñß-$fenc; do
if [ $ienc != uptex -a $doc = fn£¥µÆÇñß-$fenc ]; then
continue
fi
- if [ "$COMSPEC" != "" ]; then
- echo "*** We guess OS is Windows."
- if [ $ienc = uptex ]; then
- command_line_encoding=utf8
- export command_line_encoding
- else
- command_line_encoding=none
- export command_line_encoding
- fi
- fi
-
- echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
- ./euptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >euptests/$doc-$ienc-term.log || rc=1
- mv $doc-$ienc.txt $doc-$ienc.log euptests/
- diff euptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=2
-
-done
-done
-
-if [ $pret = 239 ]; then
- echo "*** skip tests for Shift_JIS & EUC-JP."
- exit 0
-fi
-
-
-# pTeX compatible mode, regacy encoding
-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
if [ $ienc = uptex ]; then
command_line_encoding=utf8
export command_line_encoding
@@ -83,22 +79,27 @@ for doc in fnさざ波-$fenc; do
command_line_encoding=none
export command_line_encoding
fi
- else
- echo "*** We guess OS is not Windows."
- if [ $fenc != sjis ]; then ienc="euc"; fi
- fi
- if [ $ienc != uptex ]; then
- guess_input_kanji_encoding=1
- export guess_input_kanji_encoding
fi
echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
- ./euptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >euptests/$doc-$fenc-term.log || rc=3
- mv $doc-$ienc.txt $doc-$ienc.log euptests/
- diff euptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=4
+ $_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" ; }
done
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
diff --git a/Build/source/texk/web2c/euptexdir/wcfname0.test b/Build/source/texk/web2c/euptexdir/wcfname0.test
new file mode 100755
index 00000000000..9aaa3d9157d
--- /dev/null
+++ b/Build/source/texk/web2c/euptexdir/wcfname0.test
@@ -0,0 +1,136 @@
+#! /bin/sh -vx
+#
+# Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org>
+# You may freely use, modify and/or distribute this file.
+
+engine=euptex
+testdir=eup0tests
+
+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="$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\$"
+ 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
+
+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 77
+fi
+
+# upTeX internal encoding
+fenc="utf8"
+for ienc in $try_ienc; do
+for doc in fn-$fenc fnさざ波-$fenc; do
+
+ if [ $MyOS = Windows ]; then
+ command_line_encoding=none
+ export command_line_encoding
+ fi
+
+ echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
+ $_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
+
+if [ $pret = 239 ]; then
+ echo "*** skip tests for Shift_JIS & EUC-JP."
+ exit 0
+fi
+
+
+# pTeX compatible mode, regacy encoding
+for fenc in sjis euc; do
+for doc in fnさざ波-$fenc; do
+
+ ienc=$fenc
+ if [ $MyOS = Windows ]; then
+ ienc="sjis"
+ command_line_encoding=none
+ export command_line_encoding
+ else
+ if [ $fenc != sjis ]; then ienc="euc"; fi
+ fi
+ guess_input_kanji_encoding=1
+ export guess_input_kanji_encoding
+
+ echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
+ $_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