summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir/wcfname.test
blob: 20d34b003e677022a89107a32647f24a62e762e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /bin/sh -vx
#
# Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.

engine=pdftex
testdir=pdftests

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="$testdir;."; export TEXINPUTS

$_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

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 fnΔДदダ打다𝕯🎉-$fenc; do

  echo '>>> Document:'$doc '  File Encoding:'$fenc
  $_kpsewhich -progname=$engine $doc.tex || rc=10
  $_kpsewhich -progname=$engine fn±×÷§¶-utf8.tex || rc=11
  $_tex -ini -interaction nonstopmode -jobname=$doc --shell-escape --recorder $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 $doc.fls $testdir/ || rc=14
##   It does not work.
##  diff $testdir/$doc.txt $srcdir/tests/fn-$fenc.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