diff options
author | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2018-10-06 22:44:31 +0000 |
---|---|---|
committer | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2018-10-06 22:44:31 +0000 |
commit | fce63726362d4cc973c1f4faa945e5b940d0c390 (patch) | |
tree | ec727edb41c76bb06b1749a67763e1c19c5cc938 /Build/source | |
parent | 8e4246f62b13f5361448ea56cf2f6a670366ce39 (diff) |
dviout-util: more test
git-svn-id: svn://tug.org/texlive/trunk@48848 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/dviout-util/ChangeLog | 1 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/Makefile.am | 2 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/Makefile.in | 2 | ||||
-rwxr-xr-x | Build/source/texk/dviout-util/chkdvifont.test | 6 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/dvispc.c | 12 | ||||
-rwxr-xr-x | Build/source/texk/dviout-util/dvispc.test | 40 |
6 files changed, 43 insertions, 20 deletions
diff --git a/Build/source/texk/dviout-util/ChangeLog b/Build/source/texk/dviout-util/ChangeLog index a7a664cc0c6..7c205e7c7c2 100644 --- a/Build/source/texk/dviout-util/ChangeLog +++ b/Build/source/texk/dviout-util/ChangeLog @@ -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. diff --git a/Build/source/texk/dviout-util/Makefile.am b/Build/source/texk/dviout-util/Makefile.am index 108956ce042..05fca2dd27a 100644 --- a/Build/source/texk/dviout-util/Makefile.am +++ b/Build/source/texk/dviout-util/Makefile.am @@ -33,7 +33,7 @@ EXTRA_DIST = $(TESTS) 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 diff --git a/Build/source/texk/dviout-util/Makefile.in b/Build/source/texk/dviout-util/Makefile.in index 4140ed953b3..4042452724b 100644 --- a/Build/source/texk/dviout-util/Makefile.in +++ b/Build/source/texk/dviout-util/Makefile.in @@ -561,7 +561,7 @@ 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 = 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 diff --git a/Build/source/texk/dviout-util/chkdvifont.test b/Build/source/texk/dviout-util/chkdvifont.test index 300efe5fea5..2f0e65bdc2c 100755 --- a/Build/source/texk/dviout-util/chkdvifont.test +++ b/Build/source/texk/dviout-util/chkdvifont.test @@ -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 diff --git a/Build/source/texk/dviout-util/dvispc.c b/Build/source/texk/dviout-util/dvispc.c index dfbb279beb5..b214730a8c7 100644 --- a/Build/source/texk/dviout-util/dvispc.c +++ b/Build/source/texk/dviout-util/dvispc.c @@ -690,10 +690,10 @@ skip: ; 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 @@ skip: ; 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 @@ skip: ; } } /* [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 @@ same: strcpy(outfile, infile); #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 @@ same: strcpy(outfile, infile); 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)) diff --git a/Build/source/texk/dviout-util/dvispc.test b/Build/source/texk/dviout-util/dvispc.test index 28640601105..452962ead14 100755 --- a/Build/source/texk/dviout-util/dvispc.test +++ b/Build/source/texk/dviout-util/dvispc.test @@ -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 + +./dvispc -a $testdir/test.dvi > x1testa.txt && \ + ./dvispc -x < x1testa.txt > x1testax.dvi && \ + cmp $testdir/test.dvi x1testax.dvi && echo || exit 10 -exit $rc +exit 0 |