Debian Codegraph @

texk/web2c/pdftexdir/wcfname.test

raw
1 #! /bin/sh -vx
2 #
3 # Copyright 2022-2023 Japanese TeX Development Community <[email protected]>
4 # You may freely use, modify and/or distribute this file.
5
6 engine=pdftex
7 testdir=pdftests
8
9 KpsDir=${KpsDir:-../kpathsea}
10 BinDir=${BinDir:-.}
11 ExeExt=${ExeExt:-}
12 _kpsewhich=$KpsDir/kpsewhich$ExeExt
13 _tex=$BinDir/$engine$ExeExt
14
15 test -d $testdir || mkdir -p $testdir
16 rm -f $testdir/fn*.log $testdir/fn*.txt $testdir/fn*-tmp*.tex
17
18 rc=0; err1=; err2=
19
20 TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
21 TEXINPUTS="$testdir;."; export TEXINPUTS
22
23 $_kpsewhich -var-value=TEXMFCNF
24 $_kpsewhich -progname=$engine -var-value=TEXINPUTS
25 $_kpsewhich -progname=$engine -var-value=command_line_encoding
26
27 for loc in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8 ja_JP.UTF-8 ja_JP.utf8; do
28 locale -a | grep "^$loc\$"
29 ret=$?
30 # For Slackware linux, we need to replace from utf8 to UTF-8
31 if [ -f /etc/slackware-version ]; then
32 loc=`echo $loc | sed -e "s/utf8/UTF-8/"`
33 fi
34 if [ $ret = 0 ]; then
35 LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
36 break
37 fi
38 done
39 if [ $ret != 0 ]; then
40 # linux musl fails to run `locale -a` but seems to have C.UTF-8
41 loc=C.UTF-8
42 LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
43 fi
44
45 if [ "$COMSPEC" != "" ] || [ "$ExeExt" = ".exe" ]; then
46 echo "*** We guess OS is Windows."
47 command_line_encoding=utf8
48 export command_line_encoding
49 fi
50 if [ "$ExeExt" = ".exe" ]; then
51 opt_win=-windows
52 else
53 opt_win=
54 fi
55
56 perl -s $srcdir/tests/fn-generate.perl $opt_win -randgen=pdfuniformdeviate $testdir
57 pret=$?
58 if [ $pret != 0 ] && [ $pret != 239 ]; then
59 exit 77
60 fi
61 rm -f $testdir/fn*-euc.tex $testdir/fn*-sjis.tex
62
63 fenc="utf8"
64 for doc in fn-$fenc fn£¥µÆÇñß-$fenc fnさざ波-$fenc fnΔДदダ打다𝕯🎉-$fenc; do
65
66 echo '>>> Document:'$doc ' File Encoding:'$fenc
67 job=$doc-pdf
68 $_kpsewhich -progname=$engine $doc.tex || rc=10
69 $_kpsewhich -progname=$engine fn±×÷§¶-utf8.tex || rc=11
70 rm -f $testdir/$doc-tmp.tex $testdir/$job.txt $testdir/$job.log $testdir/$job.fls
71 $_tex -ini -interaction nonstopmode -jobname=$job --shell-escape -etex --recorder $doc.tex >$testdir/$doc-term.log || \
72 { rc=1 ; err1=$err1" $fenc:$doc" ; }
73 $_kpsewhich -progname=$engine $doc-tmp.tex || rc=12
74 mv $job.txt $job.log $job.fls $testdir/ || rc=14
75 ## It does not work.
76 ## diff $testdir/$job.txt $srcdir/tests/fn-$fenc.txt || \
77 ## { rc=2 ; err2=$err2" $fenc:$doc" ; }
78
79 done
80
81
82 if [ $rc -gt 0 ]; then
83 if [ -n "$err1" ]; then echo ERROR1 $err1; fi
84 if [ -n "$err2" ]; then echo ERROR2 $err2; fi
85 else
86 echo PASS
87 fi
88 exit $rc