From eff993d7c0a0f9d4bd045d69fbd26d30b452cb95 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 29 Sep 2011 12:07:00 +0000 Subject: dvidvi: small bug fix; add a simple test case git-svn-id: svn://tug.org/texlive/trunk@24130 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvidvi/ChangeLog | 10 +++ Build/source/texk/dvidvi/Makefile.am | 11 ++- Build/source/texk/dvidvi/Makefile.in | 120 +++++++++++++++++++++++++++---- Build/source/texk/dvidvi/dvidvi.c | 5 ++ Build/source/texk/dvidvi/dvidvi.test | 12 ++++ Build/source/texk/dvidvi/tests/playout.2 | 5 ++ 6 files changed, 147 insertions(+), 16 deletions(-) create mode 100755 Build/source/texk/dvidvi/dvidvi.test create mode 100644 Build/source/texk/dvidvi/tests/playout.2 (limited to 'Build/source/texk') diff --git a/Build/source/texk/dvidvi/ChangeLog b/Build/source/texk/dvidvi/ChangeLog index 70bdfa8a9d0..e9d630d3216 100644 --- a/Build/source/texk/dvidvi/ChangeLog +++ b/Build/source/texk/dvidvi/ChangeLog @@ -1,3 +1,13 @@ +2011-09-25 Peter Breitenlohner + + * dvidvi.test: New shell script for tests. + * tests/{play.dvi,playout.2}: Test input and expected output. + * Makefile.am: Add the test and its data. + +2011-09-23 Peter Breitenlohner + + * dvidvi.c (writedvifile): Write newline at end of stdout. + 2011-04-18 Peter Breitenlohner * dvidvi.c (writepreamble): Cast string literal to 'unsigned diff --git a/Build/source/texk/dvidvi/Makefile.am b/Build/source/texk/dvidvi/Makefile.am index 30bdf7867de..9083f8f984c 100644 --- a/Build/source/texk/dvidvi/Makefile.am +++ b/Build/source/texk/dvidvi/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/dvidvi/ ## -## Copyright (C) 2009, 2010 Peter Breitenlohner +## Copyright (C) 2009-2011 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -32,3 +32,12 @@ EXTRA_DIST = \ dvidvi.kohm-patch \ dvisamp.tex +## Tests +## +TESTS = dvidvi.test +EXTRA_DIST += $(TESTS) + +## dvidvi.test +EXTRA_DIST += tests/play.dvi tests/playout.2 +DISTCLEANFILES = play*.2 play*.dvi + diff --git a/Build/source/texk/dvidvi/Makefile.in b/Build/source/texk/dvidvi/Makefile.in index 04be77d2070..b72f248b4c6 100644 --- a/Build/source/texk/dvidvi/Makefile.in +++ b/Build/source/texk/dvidvi/Makefile.in @@ -113,6 +113,8 @@ NROFF = nroff MANS = $(dist_man1_MANS) ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -249,18 +251,12 @@ AM_CPPFLAGS = -DKPATHSEA -DUNIX AM_CFLAGS = $(WARNING_CFLAGS) dvidvi_SOURCES = dvidvi.c dist_man1_MANS = dvidvi.1 -EXTRA_DIST = \ - a5bookle.bat \ - a5bookle.com \ - a5bookle.hlp \ - a5test.tex \ - build.com \ - doubside.bat \ - doubside.com \ - doubside.hlp \ - dvidvi.kohm-patch \ - dvisamp.tex - +EXTRA_DIST = a5bookle.bat a5bookle.com a5bookle.hlp a5test.tex \ + build.com doubside.bat doubside.com doubside.hlp \ + dvidvi.kohm-patch dvisamp.tex $(TESTS) tests/play.dvi \ + tests/playout.2 +TESTS = dvidvi.test +DISTCLEANFILES = play*.2 play*.dvi all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -488,6 +484,98 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ @@ -649,6 +737,7 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(MANS) config.h installdirs: @@ -676,6 +765,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -755,10 +845,10 @@ uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 -.MAKE: all install-am install-strip +.MAKE: all check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-generic clean-libtool ctags dist \ +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-binPROGRAMS clean-generic clean-libtool ctags dist \ dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ diff --git a/Build/source/texk/dvidvi/dvidvi.c b/Build/source/texk/dvidvi/dvidvi.c index 1b0258e5392..e3cb9770397 100644 --- a/Build/source/texk/dvidvi/dvidvi.c +++ b/Build/source/texk/dvidvi/dvidvi.c @@ -1213,6 +1213,11 @@ static void writedvifile(void) { if (beginp != 1) endpage() ; } writepostamble() ; + if (! quiet) { + (void)fprintf(stderr, "\n") ; + (void)fflush(stderr) ; + prettycolumn = 0 ; + } } int main(int argc, char *argv[]) { diff --git a/Build/source/texk/dvidvi/dvidvi.test b/Build/source/texk/dvidvi/dvidvi.test new file mode 100755 index 00000000000..926017b7c92 --- /dev/null +++ b/Build/source/texk/dvidvi/dvidvi.test @@ -0,0 +1,12 @@ +#! /bin/sh + +# Copyright (C) 2011 Peter Breitenlohner +# You may freely use, modify and/or distribute this file. + +rm -rf play* +cp $srcdir/tests/play.dvi . +./dvidvi -f 5 -l @25 -m'4:-3,0(6,0)' play playout \ + 2>playout.2 \ + && diff playout.2 $srcdir/tests/playout.2 \ + || exit 1 + diff --git a/Build/source/texk/dvidvi/tests/playout.2 b/Build/source/texk/dvidvi/tests/playout.2 new file mode 100644 index 00000000000..bd089a06737 --- /dev/null +++ b/Build/source/texk/dvidvi/tests/playout.2 @@ -0,0 +1,5 @@ + +This is dvidvi 1.1, Copyright (C) 1988-91, Radical Eye Software +Improved from 1.0 to 1.1, 1994, Markus Kohm +play.dvi -> playout.dvi +[5] [12] [9] [8] [13] -- cgit v1.2.3