texlive[48848] Build/source/texk/dviout-util: dviout-util: more test

commits+hironobu at tug.org commits+hironobu at tug.org
Sun Oct 7 00:44:32 CEST 2018


Revision: 48848
          http://tug.org/svn/texlive?view=revision&revision=48848
Author:   hironobu
Date:     2018-10-07 00:44:31 +0200 (Sun, 07 Oct 2018)
Log Message:
-----------
dviout-util: more test

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.test
    trunk/Build/source/texk/dviout-util/dvispc.c
    trunk/Build/source/texk/dviout-util/dvispc.test

Modified: trunk/Build/source/texk/dviout-util/ChangeLog
===================================================================
--- trunk/Build/source/texk/dviout-util/ChangeLog	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/ChangeLog	2018-10-06 22:44:31 UTC (rev 48848)
@@ -3,6 +3,7 @@
 	* dvispc.c: Change option handling for future extensions.
 	Make sure binary with trace does not fail tests by
 	prioritizing infile and outfile as explicit arguments.
+	* chkdvifont.test, dvispc.test: More tests stdin/stdout.
 	* chkdvifont.man, dvispc.man: New man pages.
 	* Makefile.am: Adjusted.
 	* configure.ac: Version 20181006.

Modified: trunk/Build/source/texk/dviout-util/Makefile.am
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.am	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/Makefile.am	2018-10-06 22:44:31 UTC (rev 48848)
@@ -33,7 +33,7 @@
 EXTRA_DIST += \
 	tests/test.tex tests/test.dvi tests/test.spc \
 	tests/testout.dvi
-DISTCLEANFILES = xtest.spc xtestout.dvi xtesta.txt xtestax.dvi
+DISTCLEANFILES = x*test.spc x*testout.dvi x*testa.txt x*testax.dvi
 
 ## chkdvifont.test
 EXTRA_DIST += tests/test.cfn

Modified: trunk/Build/source/texk/dviout-util/Makefile.in
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.in	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/Makefile.in	2018-10-06 22:44:31 UTC (rev 48848)
@@ -561,7 +561,7 @@
 TESTS = dvispc.test chkdvifont.test
 EXTRA_DIST = $(TESTS) tests/test.tex tests/test.dvi tests/test.spc \
 	tests/testout.dvi tests/test.cfn
-DISTCLEANFILES = xtest.spc xtestout.dvi xtesta.txt xtestax.dvi \
+DISTCLEANFILES = x*test.spc x*testout.dvi x*testa.txt x*testax.dvi \
 	test.dvi xtest.cfn
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am

Modified: trunk/Build/source/texk/dviout-util/chkdvifont.test
===================================================================
--- trunk/Build/source/texk/dviout-util/chkdvifont.test	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/chkdvifont.test	2018-10-06 22:44:31 UTC (rev 48848)
@@ -5,11 +5,9 @@
 
 testdir=$srcdir/tests
 
-rc=0
-
 cp $testdir/test.dvi . && \
   ./chkdvifont -c ./test.dvi > xtest.cfn && \
-  diff $testdir/test.cfn xtest.cfn && echo || rc=1
+  diff $testdir/test.cfn xtest.cfn && echo || exit 1
 
-exit $rc
+exit 0
 

Modified: trunk/Build/source/texk/dviout-util/dvispc.c
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.c	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/dvispc.c	2018-10-06 22:44:31 UTC (rev 48848)
@@ -690,10 +690,10 @@
             usage(1);
     }
 #ifndef UNIX
-    if(fp_out && (f_mode == EXE2DVI || (f_mode & EXE2INDEP)))
+    if(fp_out && !*outfile && (f_mode == EXE2DVI || (f_mode & EXE2INDEP)))
         setmode( fileno( stdout ), O_BINARY);
 #endif
-    if(fp_in && !infile && f_mode != EXE2DVI){
+    if(fp_in && !*infile && f_mode != EXE2DVI){
         fprintf(stderr, "*** stdin is a DVI file. ***\n"
             "*** Random Access may not be supported! ***\n");
 #ifndef UNIX
@@ -704,7 +704,7 @@
     if(f_mode == EXE2DVI){
         /* use infile if given, otherwise use existing fp_in (= non-empty stdin)
            note that fp_in and infile are exclusive (already checked above) */
-        if(fp_in == NULL || infile){
+        if(fp_in == NULL || *infile){
             fp_in = fopen(infile, READ_TEXT);
             if(fp_in == NULL){
                 fprintf(stderr, "Cannot open %s\n", infile);
@@ -712,7 +712,7 @@
             }
         }
         /* [TODO] I'd like to use outfile if given */
-        if(fp_out == NULL || outfile){
+        if(fp_out == NULL || *outfile){
             len = strlen(outfile);
             if(len < 4 || StrCmp(outfile + len - 4, ".dvi"))
                 strcat(outfile, ".dvi");
@@ -772,7 +772,7 @@
 #endif
             goto same;
     }
-    if(fp_in && !infile){
+    if(fp_in && !*infile){
         dvi_info.file_ptr = fp_in;
         dvi_info.file_name = "stdin";
     }else if ((dvi_info.file_ptr = fopen(dvi_info.file_name, READ_BINARY)) == NULL){
@@ -780,7 +780,7 @@
         exit(1);
     }
     /* [TODO] I'd like to use outfile if given */
-    if(fp_out == NULL || outfile){
+    if(fp_out == NULL || *outfile){
         if(!*outfile)
             fp_out = (f_mode == EXE2TEXT || f_mode == EXE2SPECIAL)?stdout:stderr;
         else if((f_mode & EXE2INDEP))

Modified: trunk/Build/source/texk/dviout-util/dvispc.test
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.test	2018-10-06 21:52:30 UTC (rev 48847)
+++ trunk/Build/source/texk/dviout-util/dvispc.test	2018-10-06 22:44:31 UTC (rev 48848)
@@ -5,17 +5,41 @@
 
 testdir=$srcdir/tests
 
-rc=0
+./dvispc -s $testdir/test.dvi xtest.spc && \
+  diff $testdir/test.spc xtest.spc && echo || exit 1
 
-./dvispc -s $testdir/test.dvi > xtest.spc && \
-  diff $testdir/test.spc xtest.spc && echo || rc=1
+./dvispc -s $testdir/test.dvi > x1test.spc && \
+  diff $testdir/test.spc x1test.spc && echo || exit 2
 
-./dvispc -c $testdir/test.dvi xtestout.dvi >/dev/null && \
-  cmp $testdir/testout.dvi xtestout.dvi && echo || rc=2
+## invalid usage
+#./dvispc -s < $testdir/test.dvi x2test.spc && \
+#  diff $testdir/test.spc x2test.spc && echo || exit 3
 
+## 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
+
+./dvispc -c $testdir/test.dvi xtestout.dvi && \
+  cmp $testdir/testout.dvi xtestout.dvi && echo || exit 5
+
+./dvispc -c $testdir/test.dvi > x1testout.dvi && \
+  cmp $testdir/testout.dvi x1testout.dvi && echo || exit 6
+
+## invalid usage
+#./dvispc -c < $testdir/test.dvi x2testout.dvi && \
+#  cmp $testdir/testout.dvi x2testout.dvi && echo || exit 7
+
+## 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
+
 ./dvispc -a $testdir/test.dvi xtesta.txt && \
-  ./dvispc -x xtesta.txt xtestax.dvi >/dev/null && \
-  cmp $testdir/test.dvi xtestax.dvi && echo || rc=4
+  ./dvispc -x xtesta.txt xtestax.dvi && \
+  cmp $testdir/test.dvi xtestax.dvi && echo || exit 9
 
-exit $rc
+./dvispc -a $testdir/test.dvi > x1testa.txt && \
+  ./dvispc -x < x1testa.txt > x1testax.dvi && \
+  cmp $testdir/test.dvi x1testax.dvi && echo || exit 10
 
+exit 0
+



More information about the tex-live-commits mailing list