summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-10-08 05:17:16 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-10-08 05:17:16 +0000
commit4035757aa66a5534ccc30eb097fb0845556d56d4 (patch)
tree408675d906512c07d4338d8cd25edfde9abe52de
parente1b9cf87baef11b81bea37509a615a39c237559a (diff)
dviout-util: fix bugs, more comprehensive tests
git-svn-id: svn://tug.org/texlive/trunk@48857 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dviout-util/ChangeLog10
-rw-r--r--Build/source/texk/dviout-util/Makefile.am13
-rw-r--r--Build/source/texk/dviout-util/Makefile.in9
-rw-r--r--Build/source/texk/dviout-util/chkdvifont.c20
-rwxr-xr-xBuild/source/texk/dviout-util/chkdvifont.test39
-rwxr-xr-xBuild/source/texk/dviout-util/dvispc.test63
-rw-r--r--Build/source/texk/dviout-util/tests/cmr10.cfn9
-rw-r--r--Build/source/texk/dviout-util/tests/cmr10.pkbin0 -> 10892 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/eufm10.cfn7
-rw-r--r--Build/source/texk/dviout-util/tests/eufm10.tfmbin0 -> 1040 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/jis.cfn7
-rw-r--r--Build/source/texk/dviout-util/tests/jis.tfmbin0 -> 468 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/oldindep.dvibin0 -> 1080 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/oldindep.tex14
-rw-r--r--Build/source/texk/dviout-util/tests/oldindepout.dvibin0 -> 1152 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/upjisr-h.cfn16
-rw-r--r--Build/source/texk/dviout-util/tests/upjisr-h.vfbin0 -> 653500 bytes
17 files changed, 175 insertions, 32 deletions
diff --git a/Build/source/texk/dviout-util/ChangeLog b/Build/source/texk/dviout-util/ChangeLog
index 7c205e7c7c2..68fe7ce1932 100644
--- a/Build/source/texk/dviout-util/ChangeLog
+++ b/Build/source/texk/dviout-util/ChangeLog
@@ -1,3 +1,13 @@
+2018-10-07 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * chkdvifont.c: Checksum should be read as unsigned.
+ Exit code 0 when called without argument and input M.
+ * chkdvifont.test, dvispc.test: Test compatibility with
+ old version.
+ * tests/oldindep.{tex,dvi}, tests/oldindepout.dvi,
+ tests/jis.{tfm,cfn}, tests/eufm10.{tfm,cfn}
+ tests/cmr10.{pk,cfn}, tests/upjisr-h.{vf,cfn}: New tests.
+
2018-10-06 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
* dvispc.c: Change option handling for future extensions.
diff --git a/Build/source/texk/dviout-util/Makefile.am b/Build/source/texk/dviout-util/Makefile.am
index 05fca2dd27a..b4fdcd1ea44 100644
--- a/Build/source/texk/dviout-util/Makefile.am
+++ b/Build/source/texk/dviout-util/Makefile.am
@@ -33,9 +33,16 @@ EXTRA_DIST = $(TESTS)
EXTRA_DIST += \
tests/test.tex tests/test.dvi tests/test.spc \
tests/testout.dvi
-DISTCLEANFILES = x*test.spc x*testout.dvi x*testa.txt x*testax.dvi
+DISTCLEANFILES = x*test.spc x*testa.txt x*testax.dvi \
+ x*oldindepout.dvi x*testout.dvi
## chkdvifont.test
-EXTRA_DIST += tests/test.cfn
-DISTCLEANFILES += test.dvi xtest.cfn
+EXTRA_DIST += tests/test.cfn \
+ tests/jis.tfm tests/jis.cfn \
+ tests/eufm10.tfm tests/eufm10.cfn \
+ tests/cmr10.pk tests/cmr10.cfn \
+ tests/upjisr-h.vf tests/upsjir-h.cfn
+DISTCLEANFILES += test.dvi xtest.cfn \
+ tests/xjis.cfn xeufm10.cfn xeufm10.ed.cfn \
+ xcmr10.cfn xupsjir-h.cfn
diff --git a/Build/source/texk/dviout-util/Makefile.in b/Build/source/texk/dviout-util/Makefile.in
index 4042452724b..39f04bc53cb 100644
--- a/Build/source/texk/dviout-util/Makefile.in
+++ b/Build/source/texk/dviout-util/Makefile.in
@@ -560,9 +560,12 @@ dvispc_LDADD = $(PTEXENC_LIBS) $(LDADD)
dist_man1_MANS = dvispc.man chkdvifont.man
TESTS = dvispc.test chkdvifont.test
EXTRA_DIST = $(TESTS) tests/test.tex tests/test.dvi tests/test.spc \
- tests/testout.dvi tests/test.cfn
-DISTCLEANFILES = x*test.spc x*testout.dvi x*testa.txt x*testax.dvi \
- test.dvi xtest.cfn
+ tests/testout.dvi tests/test.cfn tests/jis.tfm tests/jis.cfn \
+ tests/eufm10.tfm tests/eufm10.cfn tests/cmr10.pk \
+ tests/cmr10.cfn tests/upjisr-h.vf tests/upsjir-h.cfn
+DISTCLEANFILES = x*test.spc x*testa.txt x*testax.dvi x*oldindepout.dvi \
+ x*testout.dvi test.dvi xtest.cfn tests/xjis.cfn xeufm10.cfn \
+ xeufm10.ed.cfn xcmr10.cfn xupsjir-h.cfn
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/Build/source/texk/dviout-util/chkdvifont.c b/Build/source/texk/dviout-util/chkdvifont.c
index b2ba39e44e7..d2906bd66f2 100644
--- a/Build/source/texk/dviout-util/chkdvifont.c
+++ b/Build/source/texk/dviout-util/chkdvifont.c
@@ -927,7 +927,7 @@ void tfm_define(FILE * fp)
font.n, ch, u, bc, ec);
}
- font.c = read_long(fp); /* header[0] */
+ font.c = read_n(fp,4); /* header[0] */
font.d = read_long(fp); /* header[1] */
fclose(fp);
check_font();
@@ -994,7 +994,7 @@ void pxl_define(FILE * fp)
fseek(fp, -20L, SEEK_END);
else
fseek(fp, f_end - 20, SEEK_SET);
- font.c = read_long(fp);
+ font.c = read_n(fp,4);
pmag = read_long(fp);
font.d = read_long(fp);
break;
@@ -1006,7 +1006,7 @@ void pxl_define(FILE * fp)
fseek(fp, -28L, SEEK_END);
else
fseek(fp, f_end - 28, SEEK_END);
- font.c = read_long(fp);
+ font.c = read_n(fp,4);
pmag = read_long(fp);
font.d = read_long(fp);
}
@@ -1051,7 +1051,7 @@ void pxl_define(FILE * fp)
(void)read_byte(fp);
pk3:f_t = PK_FILE;
font.d = read_long(fp);
- font.c = read_long(fp);
+ font.c = read_n(fp,4);
hppp = read_long(fp);
vppp = read_long(fp);
break;
@@ -1074,7 +1074,7 @@ void font_define(int code, FILE * dvifile)
int i, len, lenm;
font.k = read_n(dvifile, code - FNT_DEF_1 + 1);
- font.c = read_long(dvifile);
+ font.c = read_n(dvifile,4);
font.s = read_long(dvifile);
font.d = read_long(dvifile);
font.a = read_byte(dvifile);
@@ -1092,7 +1092,7 @@ void vf_define(int code, FILE * vffile)
int i, len, lenm;
vffont.k = read_n(vffile, code - FNT_DEF_1 + 1);
- vffont.c = read_long(vffile);
+ vffont.c = read_n(vffile,4);
vffont.s = read_long(vffile);
vffont.d = read_long(vffile);
vffont.a = read_byte(vffile);
@@ -1106,7 +1106,7 @@ void vf_define(int code, FILE * vffile)
}
int read_uint(FILE * fp)
-{ /* read signed integer */
+{ /* read unsigned integer */
int d;
d = (uchar)getc(fp);
@@ -1115,7 +1115,7 @@ int read_uint(FILE * fp)
}
long read_mit(FILE * fp)
-{ /* read three bytes as a long integer */
+{ /* read three bytes as long integer */
long d;
d = (uchar)getc(fp);
@@ -1164,7 +1164,7 @@ char *
}
long read_n(FILE * fp, int n)
-{
+{ /* read 1--4 bytes as unsigned long integer */
ulong d;
d = (uchar)getc(fp);
@@ -1288,6 +1288,6 @@ void usage()
"eufm10 BF989013 8F256EB2\n"
"# The line beginning with # or ; is ignored.\n"
);
- exit(250);
+ exit(0);
}
diff --git a/Build/source/texk/dviout-util/chkdvifont.test b/Build/source/texk/dviout-util/chkdvifont.test
index 2f0e65bdc2c..d2a76ed5f0e 100755
--- a/Build/source/texk/dviout-util/chkdvifont.test
+++ b/Build/source/texk/dviout-util/chkdvifont.test
@@ -5,9 +5,46 @@
testdir=$srcdir/tests
+# pre-generated test results in the repository are stored in LF
+# but the output might be written in CRLF on some platform.
+# if 'diff --strip-trailing-cr' is available, exploit it.
+# (useful for tests on win32 binaries run on MSYS shell)
+diffoptCRLF=--strip-trailing-cr
+diff --strip-trailing-cr $testdir/test.spc $testdir/test.spc \
+ && diffoptCRLF=--strip-trailing-cr || echo
+
+
+## DVI mode
+
cp $testdir/test.dvi . && \
./chkdvifont -c ./test.dvi > xtest.cfn && \
- diff $testdir/test.cfn xtest.cfn && echo || exit 1
+ diff $diffoptCRLF $testdir/test.cfn xtest.cfn && echo || exit 1
+
+
+## TFM/JFM mode
+
+./chkdvifont -c $testdir/jis.tfm > xjis.cfn && \
+ diff $diffoptCRLF $testdir/jis.cfn xjis.cfn && echo || exit 2
+
+# eufm10.tfm is "AMSTeX 2.0 or newer", exit code should be 4
+./chkdvifont -c $testdir/eufm10.tfm > xeufm10.cfn
+ if [ $? -ne 4 ]; then exit 3; fi
+ sed 's!2.0/2.1!2.0 or newer!' xeufm10.cfn > xeufm10.ed.cfn
+ diff $diffoptCRLF $testdir/eufm10.cfn xeufm10.ed.cfn && echo || exit 3
+
+## FONT mode
+
+./chkdvifont -c $testdir/cmr10.pk > xcmr10.cfn && \
+ diff $diffoptCRLF $testdir/cmr10.cfn xcmr10.cfn && echo || exit 4
+
+echo M | ./chkdvifont && echo || exit 0
+
+# VF format is not supported by old version written by SHIMA.
+# that version can be distinguished from the new version by
+# exit code 250 for usage with stdin M. (the above line did it!)
+
+./chkdvifont -c $testdir/upjisr-h.vf > xupjisr-h.cfn && \
+ diff $diffoptCRLF $testdir/upjisr-h.cfn xupjisr-h.cfn && echo || exit 5
exit 0
diff --git a/Build/source/texk/dviout-util/dvispc.test b/Build/source/texk/dviout-util/dvispc.test
index 452962ead14..c176542518c 100755
--- a/Build/source/texk/dviout-util/dvispc.test
+++ b/Build/source/texk/dviout-util/dvispc.test
@@ -5,41 +5,74 @@
testdir=$srcdir/tests
+# pre-generated test results in the repository are stored in LF
+# but the output might be written in CRLF on some platform.
+# if 'diff --strip-trailing-cr' is available, exploit it.
+# (useful for tests on win32 binaries run on MSYS shell)
+diffoptCRLF=--strip-trailing-cr
+diff --strip-trailing-cr $testdir/test.spc $testdir/test.spc \
+ && diffoptCRLF=--strip-trailing-cr || echo
+
+
+## EXE2SPECIAL
+
./dvispc -s $testdir/test.dvi xtest.spc && \
- diff $testdir/test.spc xtest.spc && echo || exit 1
+ diff $diffoptCRLF $testdir/test.spc xtest.spc && echo || exit 1
./dvispc -s $testdir/test.dvi > x1test.spc && \
- diff $testdir/test.spc x1test.spc && echo || exit 2
+ diff $diffoptCRLF $testdir/test.spc x1test.spc && echo || exit 2
## invalid usage
#./dvispc -s < $testdir/test.dvi x2test.spc && \
-# diff $testdir/test.spc x2test.spc && echo || exit 3
+# diff $testdir/test.spc x2test.spc && echo || exit 0
## stdin is a DVI, random access may not be supported, no test
#./dvispc -s < $testdir/test.dvi > x3test.spc && \
-# diff $testdir/test.spc x3test.spc && echo || exit 4
+# diff $testdir/test.spc x3test.spc && echo || exit 3
+
+
+## EXE2TEXT + EXE2DVI
+
+./dvispc -a $testdir/test.dvi xtesta.txt && \
+ ./dvispc -x xtesta.txt xtestax.dvi && \
+ cmp $testdir/test.dvi xtestax.dvi && echo || exit 4
+
+./dvispc -a $testdir/test.dvi > x1testa.txt && \
+ ./dvispc -x < x1testa.txt > x1testax.dvi && \
+ cmp $testdir/test.dvi x1testax.dvi && echo || exit 5
+
+
+## EXE2INDEP
+
+./dvispc -c $testdir/oldindep.dvi xoldindepout.dvi && \
+ cmp $testdir/oldindepout.dvi xoldindepout.dvi && echo || exit 6
+
+./dvispc -c $testdir/oldindep.dvi > x1oldindepout.dvi && \
+ cmp $testdir/oldindepout.dvi x1oldindepout.dvi && echo || exit 7
+
+./dvispc && echo || exit 0
+
+# the following tests include
+# * correction of dvipdfmx-style specials
+# * correction in reversed order which requires prior scanning
+# so will not pass for old version written by SHIMA.
+# that version can be distinguished from the new version by
+# exit code 1 for usage without argument. (the above line did it!)
./dvispc -c $testdir/test.dvi xtestout.dvi && \
- cmp $testdir/testout.dvi xtestout.dvi && echo || exit 5
+ cmp $testdir/testout.dvi xtestout.dvi && echo || exit 8
./dvispc -c $testdir/test.dvi > x1testout.dvi && \
- cmp $testdir/testout.dvi x1testout.dvi && echo || exit 6
+ cmp $testdir/testout.dvi x1testout.dvi && echo || exit 9
## invalid usage
#./dvispc -c < $testdir/test.dvi x2testout.dvi && \
-# cmp $testdir/testout.dvi x2testout.dvi && echo || exit 7
+# cmp $testdir/testout.dvi x2testout.dvi && echo || exit 0
## stdin is a DVI, random access may not be supported, no test
#./dvispc -c < $testdir/test.dvi > x3testout.dvi && \
-# cmp $testdir/testout.dvi x3testout.dvi && echo || exit 8
+# cmp $testdir/testout.dvi x3testout.dvi && echo || exit 10
-./dvispc -a $testdir/test.dvi xtesta.txt && \
- ./dvispc -x xtesta.txt xtestax.dvi && \
- cmp $testdir/test.dvi xtestax.dvi && echo || exit 9
-
-./dvispc -a $testdir/test.dvi > x1testa.txt && \
- ./dvispc -x < x1testa.txt > x1testax.dvi && \
- cmp $testdir/test.dvi x1testax.dvi && echo || exit 10
exit 0
diff --git a/Build/source/texk/dviout-util/tests/cmr10.cfn b/Build/source/texk/dviout-util/tests/cmr10.cfn
new file mode 100644
index 00000000000..4d097aa6ab7
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/cmr10.cfn
@@ -0,0 +1,9 @@
+ "cmr10.pk" is in PK format
+ checksum = 4BF16079
+ design size = 10485760 2^{-20} points = 10 points
+ horizontal = 544093 2^{-16} dots/point = 600 dpi
+ vertical = 544093 2^{-16} dots/point = 600 dpi
+
+
+EXIT Code (errorlevel) = 0
+No AMS Font
diff --git a/Build/source/texk/dviout-util/tests/cmr10.pk b/Build/source/texk/dviout-util/tests/cmr10.pk
new file mode 100644
index 00000000000..99a5a361abe
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/cmr10.pk
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/eufm10.cfn b/Build/source/texk/dviout-util/tests/eufm10.cfn
new file mode 100644
index 00000000000..224ae032253
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/eufm10.cfn
@@ -0,0 +1,7 @@
+ "eufm10" is a tfm file : 0 -> 127
+ checksum = 8F256EB2
+ design size = 10485760 2^{-20} points = 10 points
+ (AMSTeX 2.0 or newer)
+
+EXIT Code (errorlevel) = 4
+New eufm
diff --git a/Build/source/texk/dviout-util/tests/eufm10.tfm b/Build/source/texk/dviout-util/tests/eufm10.tfm
new file mode 100644
index 00000000000..34f60c3874f
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/eufm10.tfm
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/jis.cfn b/Build/source/texk/dviout-util/tests/jis.cfn
new file mode 100644
index 00000000000..964c9e42ca8
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/jis.cfn
@@ -0,0 +1,7 @@
+ "jis" is a jfm file : 0 -> 5
+ checksum = 00000000
+ design size = 10485760 2^{-20} points = 10 points
+
+
+EXIT Code (errorlevel) = 0
+No AMS Font
diff --git a/Build/source/texk/dviout-util/tests/jis.tfm b/Build/source/texk/dviout-util/tests/jis.tfm
new file mode 100644
index 00000000000..701106d78e4
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/jis.tfm
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/oldindep.dvi b/Build/source/texk/dviout-util/tests/oldindep.dvi
new file mode 100644
index 00000000000..06d76475c3c
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/oldindep.dvi
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/oldindep.tex b/Build/source/texk/dviout-util/tests/oldindep.tex
new file mode 100644
index 00000000000..333709dbbe3
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/oldindep.tex
@@ -0,0 +1,14 @@
+\documentclass{article}
+\usepackage[dvips]{color}
+\begin{document}
+\pagecolor{red}
+background red, black text
+\newpage
+{\color{blue}
+background red, blue text
+\newpage
+\pagecolor{white}
+background white, blue text}
+\newpage
+background white, black text
+\end{document}
diff --git a/Build/source/texk/dviout-util/tests/oldindepout.dvi b/Build/source/texk/dviout-util/tests/oldindepout.dvi
new file mode 100644
index 00000000000..5248e5e7516
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/oldindepout.dvi
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/upjisr-h.cfn b/Build/source/texk/dviout-util/tests/upjisr-h.cfn
new file mode 100644
index 00000000000..cd44020d4eb
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/upjisr-h.cfn
@@ -0,0 +1,16 @@
+ "upjisr-h.vf" is in VF format
+ checksum = 00000000
+ design size = 10485760 2^{-20} points = 10 points
+
+ Mapped Font 0
+ font dsize = 10485760 2^{-20} points = 10 points
+ font at = 1.000000
+ font name = uprml-h
+
+ Mapped Font 2
+ font dsize = 10485760 2^{-20} points = 10 points
+ font at = 1.000000
+ font name = upjisr-hq
+
+EXIT Code (errorlevel) = 0
+No AMS Font
diff --git a/Build/source/texk/dviout-util/tests/upjisr-h.vf b/Build/source/texk/dviout-util/tests/upjisr-h.vf
new file mode 100644
index 00000000000..9622287ff51
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/upjisr-h.vf
Binary files differ