texlive[48857] Build/source/texk/dviout-util: dviout-util: fix bugs,

commits+hironobu at tug.org commits+hironobu at tug.org
Mon Oct 8 07:17:16 CEST 2018


Revision: 48857
          http://tug.org/svn/texlive?view=revision&revision=48857
Author:   hironobu
Date:     2018-10-08 07:17:16 +0200 (Mon, 08 Oct 2018)
Log Message:
-----------
dviout-util: fix bugs, more comprehensive tests

Modified Paths:
--------------
    trunk/Build/source/texk/dviout-util/ChangeLog
    trunk/Build/source/texk/dviout-util/Makefile.am
    trunk/Build/source/texk/dviout-util/Makefile.in
    trunk/Build/source/texk/dviout-util/chkdvifont.c
    trunk/Build/source/texk/dviout-util/chkdvifont.test
    trunk/Build/source/texk/dviout-util/dvispc.test

Added Paths:
-----------
    trunk/Build/source/texk/dviout-util/tests/cmr10.cfn
    trunk/Build/source/texk/dviout-util/tests/cmr10.pk
    trunk/Build/source/texk/dviout-util/tests/eufm10.cfn
    trunk/Build/source/texk/dviout-util/tests/eufm10.tfm
    trunk/Build/source/texk/dviout-util/tests/jis.cfn
    trunk/Build/source/texk/dviout-util/tests/jis.tfm
    trunk/Build/source/texk/dviout-util/tests/oldindep.dvi
    trunk/Build/source/texk/dviout-util/tests/oldindep.tex
    trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi
    trunk/Build/source/texk/dviout-util/tests/upjisr-h.cfn
    trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf

Modified: trunk/Build/source/texk/dviout-util/ChangeLog
===================================================================
--- trunk/Build/source/texk/dviout-util/ChangeLog	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/ChangeLog	2018-10-08 05:17:16 UTC (rev 48857)
@@ -1,3 +1,13 @@
+2018-10-07  Hironobu Yamashita  <h.y.acetaminophen at 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 at gmail.com>
 
 	* dvispc.c: Change option handling for future extensions.

Modified: trunk/Build/source/texk/dviout-util/Makefile.am
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.am	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/Makefile.am	2018-10-08 05:17:16 UTC (rev 48857)
@@ -33,9 +33,16 @@
 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
 

Modified: trunk/Build/source/texk/dviout-util/Makefile.in
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.in	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/Makefile.in	2018-10-08 05:17:16 UTC (rev 48857)
@@ -560,9 +560,12 @@
 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
 

Modified: trunk/Build/source/texk/dviout-util/chkdvifont.c
===================================================================
--- trunk/Build/source/texk/dviout-util/chkdvifont.c	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/chkdvifont.c	2018-10-08 05:17:16 UTC (rev 48857)
@@ -927,7 +927,7 @@
 				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 @@
 			  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 @@
 				  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)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 @@
 	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 @@
 	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 @@
 }
 
 int read_uint(FILE * fp)
-{	   /* read signed integer */
+{	   /* read unsigned integer */
 	int d;
 
 	d = (uchar)getc(fp);
@@ -1115,7 +1115,7 @@
 }
 
 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 @@
 }
 
 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 @@
 			"eufm10	BF989013	8F256EB2\n"
 			"# The line beginning with # or ; is ignored.\n"
 		);
-	exit(250);
+	exit(0);
 }
 

Modified: trunk/Build/source/texk/dviout-util/chkdvifont.test
===================================================================
--- trunk/Build/source/texk/dviout-util/chkdvifont.test	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/chkdvifont.test	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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
 

Modified: trunk/Build/source/texk/dviout-util/dvispc.test
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.test	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/dvispc.test	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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
 

Added: trunk/Build/source/texk/dviout-util/tests/cmr10.cfn
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/cmr10.cfn	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/cmr10.cfn	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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

Added: trunk/Build/source/texk/dviout-util/tests/cmr10.pk
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/cmr10.pk
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/cmr10.pk	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/cmr10.pk	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/cmr10.pk
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/eufm10.cfn
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/eufm10.cfn	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/eufm10.cfn	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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 

Added: trunk/Build/source/texk/dviout-util/tests/eufm10.tfm
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/eufm10.tfm
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/eufm10.tfm	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/eufm10.tfm	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/eufm10.tfm
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/jis.cfn
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/jis.cfn	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/jis.cfn	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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

Added: trunk/Build/source/texk/dviout-util/tests/jis.tfm
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/jis.tfm
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/jis.tfm	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/jis.tfm	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/jis.tfm
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/oldindep.dvi
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/oldindep.dvi
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/oldindep.dvi	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/oldindep.dvi	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/oldindep.dvi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/oldindep.tex
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/oldindep.tex	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/oldindep.tex	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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}


Property changes on: trunk/Build/source/texk/dviout-util/tests/oldindep.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/oldindepout.dvi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/upjisr-h.cfn
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/upjisr-h.cfn	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/upjisr-h.cfn	2018-10-08 05:17:16 UTC (rev 48857)
@@ -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

Added: trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf	2018-10-08 00:23:08 UTC (rev 48856)
+++ trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf	2018-10-08 05:17:16 UTC (rev 48857)

Property changes on: trunk/Build/source/texk/dviout-util/tests/upjisr-h.vf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property


More information about the tex-live-commits mailing list