summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-09-29 12:08:10 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-09-29 12:08:10 +0000
commit261891c89f09f8f1eb0edd9a726e12dc3297bf1c (patch)
treebe9359c2dbf7feb6d4a6c28c609a70287a2298d3
parenteff993d7c0a0f9d4bd045d69fbd26d30b452cb95 (diff)
seetexk: bug fix; add simple test cases
git-svn-id: svn://tug.org/texlive/trunk@24131 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/seetexk/ChangeLog12
-rw-r--r--Build/source/texk/seetexk/Makefile.am11
-rw-r--r--Build/source/texk/seetexk/Makefile.in106
-rw-r--r--Build/source/texk/seetexk/dviselect.c4
-rw-r--r--Build/source/texk/seetexk/dvitodvi.c6
-rw-r--r--Build/source/texk/seetexk/dvitodvi.man4
-rwxr-xr-xBuild/source/texk/seetexk/seetexk.test44
-rw-r--r--Build/source/texk/seetexk/tests/playbook.22
-rw-r--r--Build/source/texk/seetexk/tests/playconc.25
-rw-r--r--Build/source/texk/seetexk/tests/playdvi.22
-rw-r--r--Build/source/texk/seetexk/tests/playsel.22
11 files changed, 191 insertions, 7 deletions
diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog
index dfa21b1dea6..2bd0ea8df1e 100644
--- a/Build/source/texk/seetexk/ChangeLog
+++ b/Build/source/texk/seetexk/ChangeLog
@@ -1,3 +1,15 @@
+2011-09-25 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * seetexk.test: New shell script for tests.
+ * tests/{play.dvi,play*.2}: Test input and expected output.
+ * Makefile.am: Add the test and its data.
+
+2011-09-23 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dviselect.c (main): Allow filenames to start with '../'.
+ * dvitodvi.c: Bug fix: make sure to finish the last page.
+ * dvitodvi.man: Fix a formatting problem.
+
2011-08-01 Peter Breitenlohner <peb@mppmu.mpg.de>
Remove unused files (they can still be found under
diff --git a/Build/source/texk/seetexk/Makefile.am b/Build/source/texk/seetexk/Makefile.am
index c824cb8774b..01a2b4e04ac 100644
--- a/Build/source/texk/seetexk/Makefile.am
+++ b/Build/source/texk/seetexk/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am for the TeX Live subdirectory texk/seetexk/
##
-## Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
ACLOCAL_AMFLAGS = -I ../../m4
@@ -46,3 +46,12 @@ dist_man1_MANS = dvibook.man dviconcat.man dviselect.man dvitodvi.man
## Rebuild libkpathsea
@KPATHSEA_RULE@
+## Tests
+##
+TESTS = seetexk.test
+EXTRA_DIST = $(TESTS)
+
+## seetexk.test
+EXTRA_DIST += tests/play.dvi tests/playbook.2 tests/playconc.2 tests/playdvi.2 tests/playsel.2
+DISTCLEANFILES = play*.2 play*.dvi
+
diff --git a/Build/source/texk/seetexk/Makefile.in b/Build/source/texk/seetexk/Makefile.in
index 1b1cc01cf44..1e45bd8bd98 100644
--- a/Build/source/texk/seetexk/Makefile.in
+++ b/Build/source/texk/seetexk/Makefile.in
@@ -141,6 +141,8 @@ MANS = $(dist_man1_MANS)
HEADERS = $(noinst_HEADERS)
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)
@@ -300,6 +302,10 @@ noinst_HEADERS = \
dvicodes.h
dist_man1_MANS = dvibook.man dviconcat.man dviselect.man dvitodvi.man
+TESTS = seetexk.test
+EXTRA_DIST = $(TESTS) tests/play.dvi tests/playbook.2 tests/playconc.2 \
+ tests/playdvi.2 tests/playsel.2
+DISTCLEANFILES = play*.2 play*.dvi
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -554,6 +560,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 \
@@ -715,6 +813,7 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h
installdirs:
@@ -742,6 +841,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"
@@ -822,10 +922,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 \
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES 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 \
diff --git a/Build/source/texk/seetexk/dviselect.c b/Build/source/texk/seetexk/dviselect.c
index 19408b27dca..00be970950b 100644
--- a/Build/source/texk/seetexk/dviselect.c
+++ b/Build/source/texk/seetexk/dviselect.c
@@ -506,7 +506,9 @@ Usage: %s [-s] [-i infile] [-o outfile] pages [...] [infile [outfile]]\n",
while (optind < argc) {
s = argv[optind++];
c = *s;
- if ((!isalpha(c) && c != '/') ||
+ if (!(isalpha(c) ||
+ c == '/' ||
+ (c == '.' && (s[1] == '/' || (s[1] == '.' && s[2] == '/')))) ||
((c == 'e' || c == 'o') && evenodd(s))) {
if (ParsePages(s))
goto usage;
diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c
index 9729f370163..b7377fe4e68 100644
--- a/Build/source/texk/seetexk/dvitodvi.c
+++ b/Build/source/texk/seetexk/dvitodvi.c
@@ -94,6 +94,8 @@ long CurrentPosition; /* The current position of the file */
int UseThisPage; /* true => current page is selected */
+int WritingPage; /* true while writing a page */
+
i32 InputPageNumber; /* current absolute page in old DVI file */
int NumberOfOutputPages; /* number of pages in new DVI file */
@@ -422,6 +424,7 @@ BeginPage(int really)
}
message(1, msg, mlen);
}
+ WritingPage = 1;
}
/*
@@ -440,6 +443,7 @@ EndPage(int really)
error(1, -1, writeerr);
CurrentPosition++;
NumberOfOutputPages++;
+ WritingPage = 0;
}
/*
@@ -699,6 +703,8 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi
PageSpecs = ParseSpecs(specstring, 1);
HandleDVIFile();
+ if (WritingPage)
+ EndPage(1);
HandlePostAmble();
if (!SFlag)
(void) fprintf(stderr, "\nWrote %d page%s, %ld bytes\n",
diff --git a/Build/source/texk/seetexk/dvitodvi.man b/Build/source/texk/seetexk/dvitodvi.man
index 549b5a5e8c7..0dcef91013a 100644
--- a/Build/source/texk/seetexk/dvitodvi.man
+++ b/Build/source/texk/seetexk/dvitodvi.man
@@ -82,9 +82,9 @@ If the optional minus sign is specified, the page is relative to the end of
the document, instead of the start.
If page \fIspec\fRs are separated by
-.B \+
+.B +
the pages will be merged into one page; if they are separated by
-.B \,
+.B ,
they will be on separate pages.
If there is only one page specification, with
.I pageno
diff --git a/Build/source/texk/seetexk/seetexk.test b/Build/source/texk/seetexk/seetexk.test
new file mode 100755
index 00000000000..88e580664a1
--- /dev/null
+++ b/Build/source/texk/seetexk/seetexk.test
@@ -0,0 +1,44 @@
+#! /bin/sh
+
+# Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+rm -rf play*
+./dviselect 15:25 $srcdir/tests/play.dvi playsel.dvi \
+ 2>playsel.2 \
+ && diff playsel.2 $srcdir/tests/playsel.2 \
+ || exit 1
+
+rm -rf play*
+./dviselect =5:15 $srcdir/tests/play.dvi playsel.dvi \
+ 2>playsel.2 \
+ && diff playsel.2 $srcdir/tests/playsel.2 \
+ || exit 1
+
+echo dviselect tests OK
+
+./dvibook -s4 playsel.dvi playbook.dvi \
+ 2>playbook.2 \
+ && diff playbook.2 $srcdir/tests/playbook.2 \
+ || exit 1
+
+echo dvibook tests OK
+
+./dviselect =5:7 $srcdir/tests/play.dvi playsel1.dvi \
+ 2>playconc.2 \
+ && ./dviselect 23:25 $srcdir/tests/play.dvi playsel2.dvi \
+ 2>>playconc.2 \
+ && ./dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
+ 2>>playconc.2 \
+ && diff playconc.2 $srcdir/tests/playconc.2 \
+ || exit 1
+
+echo dviconcat tests OK
+
+./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playsel.dvi playdvi.dvi \
+ 2>playdvi.2 \
+ && diff playdvi.2 $srcdir/tests/playdvi.2 \
+ || exit 1
+
+echo dvitodvi tests OK
+
diff --git a/Build/source/texk/seetexk/tests/playbook.2 b/Build/source/texk/seetexk/tests/playbook.2
new file mode 100644
index 00000000000..83eeec4dfac
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playbook.2
@@ -0,0 +1,2 @@
+[18] [15] [16] [17] [22] [19] [20] [21] [*] [23] [24] [25]
+Wrote 12 pages, 1548 bytes
diff --git a/Build/source/texk/seetexk/tests/playconc.2 b/Build/source/texk/seetexk/tests/playconc.2
new file mode 100644
index 00000000000..5937676df61
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playconc.2
@@ -0,0 +1,5 @@
+[15] [16] [17]
+Wrote 3 pages, 520 bytes
+[23] [24] [25]
+Wrote 3 pages, 536 bytes
+Wrote 6 pages, 892 bytes
diff --git a/Build/source/texk/seetexk/tests/playdvi.2 b/Build/source/texk/seetexk/tests/playdvi.2
new file mode 100644
index 00000000000..07135749d20
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playdvi.2
@@ -0,0 +1,2 @@
+[15] [19] [23]
+Wrote 3 pages, 1200 bytes
diff --git a/Build/source/texk/seetexk/tests/playsel.2 b/Build/source/texk/seetexk/tests/playsel.2
new file mode 100644
index 00000000000..af72fa4f879
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playsel.2
@@ -0,0 +1,2 @@
+[15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]
+Wrote 11 pages, 1500 bytes