summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-03 07:21:20 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-03 07:21:20 +0000
commitf19b5a5323b57d95708714b2c4a24ceca93daa4d (patch)
tree5342db3107020be08c9fa28bf131e2048591be00
parent9a69b2deaae5d25e7c858f751dab0d7095452a9c (diff)
texk/dvipdfm-x: Better detection of inconsistent DVI files and additional test
git-svn-id: svn://tug.org/texlive/trunk@38029 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog10
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.am52
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.in45
-rw-r--r--Build/source/texk/dvipdfm-x/dvi.c112
-rw-r--r--Build/source/texk/dvipdfm-x/tests/ids_2_6.dvibin0 -> 128 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/ids_3_2.dvibin0 -> 128 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/ids_a_b.dvibin0 -> 128 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/opc_fe.dvibin0 -> 128 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/ptx_2_2.dvibin0 -> 188 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/ptx_6_6.dvibin0 -> 188 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/rev_2_2.dvibin0 -> 188 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/rev_2_3.dvibin0 -> 188 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/void.dvibin0 -> 104 bytes
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfm-bad.test37
14 files changed, 189 insertions, 67 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 6c6f24730c0..9e54da35d63 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,13 @@
+2015-08-03 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dvi.c: Better detection of bad (inconsistent) DVI files.
+ * xdvipdfm-bad.test: New shell script to test bad DVI files.
+ * tests/ids_2_6.dvi, tests/ids_3_2.dvi, tests/ids_a_b.dvi,
+ tests/opc_fe.dvi, tests/ptx_2_2.dvi, tests/ptx_6_6.dvi,
+ tests/rev_2_2.dvi, tests/rev_2_3.dvi, tests/void.dvi: New test
+ input data (bad DVI files).
+ * Makefile.am: Add the new test and input data.
+
2015-07-31 Peter Breitenlohner <peb@mppmu.mpg.de>
* dvipdfmx.c, xbb.c: Use getopt_long() for option parsing.
diff --git a/Build/source/texk/dvipdfm-x/Makefile.am b/Build/source/texk/dvipdfm-x/Makefile.am
index cf9cc495583..7f96ccf0a69 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.am
+++ b/Build/source/texk/dvipdfm-x/Makefile.am
@@ -244,24 +244,50 @@ DISTCLEANFILES = config.force
## Tests
##
-TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test
-TESTS += xdvipdfm-ptx.test xdvipdfm-res.test xdvipdfm-rev.test xdvipdfm-ttc.test
-xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bb.log xdvipdfm-bkm.log xdvipdfm-psz.log \
- xdvipdfm-ptx.log xdvipdfm-res.log xdvipdfm-rev.log xdvipdfm-ttc.log: xdvipdfmx$(EXEEXT)
+TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test xdvipdfm-bb.test
+TESTS += xdvipdfm-bkm.test xdvipdfm-psz.test xdvipdfm-ptx.test xdvipdfm-res.test
+TESTS += xdvipdfm-rev.test xdvipdfm-ttc.test
+xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
+ xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
+ xdvipdfm-rev.log xdvipdfm-ttc.log: xdvipdfmx$(EXEEXT)
EXTRA_DIST = $(TESTS)
-## Test Data
+## xdvipdfmx.test
EXTRA_DIST += tests/dvipdfmx.cfg tests/psfonts.map
-EXTRA_DIST += tests/fullmap.dvi tests/fullmap.tex
+EXTRA_DIST += tests/cmr10.pfb tests/cmr10.tfm
+EXTRA_DIST += tests/image.dvi tests/image.tex
+EXTRA_DIST += tests/xbmc.dvi tests/xbmc.tex tests/xbmc10.600pk tests/xbmc10.tfm
+DISTCLEANFILES += image*.pdf xbmc*.pdf
+## xdvipdfm-ann.test
+EXTRA_DIST += tests/annot.dvi tests/annot.tex
+DISTCLEANFILES += annot*.pdf
+## xdvipdfm-bad.test
+EXTRA_DIST += tests/ids_2_6.dvi tests/ids_3_2.dvi tests/ids_a_b.dvi tests/opc_fe.dvi
+EXTRA_DIST += tests/ptx_2_2.dvi tests/ptx_6_6.dvi tests/rev_2_2.dvi tests/rev_2_3.dvi
+EXTRA_DIST += tests/void.dvi
+## xdvipdfm-bb.test
EXTRA_DIST += tests/image.bmp tests/picbmp.bb tests/picbmp.xbb
EXTRA_DIST += tests/image.jp2 tests/picjp2.bb tests/picjp2.xbb
EXTRA_DIST += tests/image.jpeg tests/picjpeg.bb tests/picjpeg.xbb
EXTRA_DIST += tests/image.png tests/picpng.bb tests/picpng.xbb
EXTRA_DIST += tests/image.pdf tests/picpdf.bb tests/picpdf.xbb
-EXTRA_DIST += tests/image.dvi tests/image.tex
-EXTRA_DIST += tests/cmr10.pfb tests/cmr10.tfm tests/annot.dvi tests/annot.tex
-EXTRA_DIST += tests/bookm.dvi tests/bookm.tex tests/paper.dvi tests/paper.tex
-EXTRA_DIST += tests/resrc.dvi tests/resrc.tex tests/ptex.dvi tests/reverse.dvi
-EXTRA_DIST += tests/xbmc.dvi tests/xbmc.tex tests/xbmc10.600pk tests/xbmc10.tfm
+DISTCLEANFILES += pic*.*
+## xdvipdfm-bkm.test
+EXTRA_DIST += tests/bookm.dvi tests/bookm.tex
+DISTCLEANFILES += bookm*.pdf
+## xdvipdfm-psz.test
+EXTRA_DIST += tests/paper.dvi tests/paper.tex
+DISTCLEANFILES += paper*.pdf
+## xdvipdfm-ptx.test
+EXTRA_DIST += tests/ptex.dvi
+DISTCLEANFILES += ptex*.pdf
+## xdvipdfm-res.test
+EXTRA_DIST += tests/resrc.dvi tests/resrc.tex
+DISTCLEANFILES += resrc*.pdf
+## xdvipdfm-rev.test
+EXTRA_DIST += tests/reverse.dvi
+DISTCLEANFILES += reverse.pdf
+## xdvipdfm-ttc.test
EXTRA_DIST += tests/ttc.dvi tests/ttc.tex tests/test.ttc
-DISTCLEANFILES += pic*.* image*.pdf annot*.pdf bookm*.pdf paper*.pdf resrc*.pdf
-DISTCLEANFILES += xbmc*.pdf ttc*.pdf ptex*.pdf reverse.pdf
+DISTCLEANFILES += ttc*.pdf
+##
+EXTRA_DIST += tests/fullmap.dvi tests/fullmap.tex
diff --git a/Build/source/texk/dvipdfm-x/Makefile.in b/Build/source/texk/dvipdfm-x/Makefile.in
index 1d4fac84af0..b38db3defa1 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.in
+++ b/Build/source/texk/dvipdfm-x/Makefile.in
@@ -779,25 +779,29 @@ mapdatadir = $(datarootdir)/texmf-dist/fonts/map/dvipdfmx
dist_mapdata_DATA = data/cid-x.map
cmapdatadir = $(datarootdir)/texmf-dist/fonts/cmap/dvipdfmx
dist_cmapdata_DATA = data/EUC-UCS2
-DISTCLEANFILES = config.force pic*.* image*.pdf annot*.pdf bookm*.pdf \
- paper*.pdf resrc*.pdf xbmc*.pdf ttc*.pdf ptex*.pdf reverse.pdf
-TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bb.test \
- xdvipdfm-bkm.test xdvipdfm-psz.test xdvipdfm-ptx.test \
- xdvipdfm-res.test xdvipdfm-rev.test xdvipdfm-ttc.test
+DISTCLEANFILES = config.force image*.pdf xbmc*.pdf annot*.pdf pic*.* \
+ bookm*.pdf paper*.pdf ptex*.pdf resrc*.pdf reverse.pdf \
+ ttc*.pdf
+TESTS = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bad.test \
+ xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test \
+ xdvipdfm-ptx.test xdvipdfm-res.test xdvipdfm-rev.test \
+ xdvipdfm-ttc.test
EXTRA_DIST = $(TESTS) tests/dvipdfmx.cfg tests/psfonts.map \
- tests/fullmap.dvi tests/fullmap.tex tests/image.bmp \
- tests/picbmp.bb tests/picbmp.xbb tests/image.jp2 \
- tests/picjp2.bb tests/picjp2.xbb tests/image.jpeg \
- tests/picjpeg.bb tests/picjpeg.xbb tests/image.png \
- tests/picpng.bb tests/picpng.xbb tests/image.pdf \
- tests/picpdf.bb tests/picpdf.xbb tests/image.dvi \
- tests/image.tex tests/cmr10.pfb tests/cmr10.tfm \
- tests/annot.dvi tests/annot.tex tests/bookm.dvi \
- tests/bookm.tex tests/paper.dvi tests/paper.tex \
- tests/resrc.dvi tests/resrc.tex tests/ptex.dvi \
- tests/reverse.dvi tests/xbmc.dvi tests/xbmc.tex \
- tests/xbmc10.600pk tests/xbmc10.tfm tests/ttc.dvi \
- tests/ttc.tex tests/test.ttc
+ tests/cmr10.pfb tests/cmr10.tfm tests/image.dvi \
+ tests/image.tex tests/xbmc.dvi tests/xbmc.tex \
+ tests/xbmc10.600pk tests/xbmc10.tfm tests/annot.dvi \
+ tests/annot.tex tests/ids_2_6.dvi tests/ids_3_2.dvi \
+ tests/ids_a_b.dvi tests/opc_fe.dvi tests/ptx_2_2.dvi \
+ tests/ptx_6_6.dvi tests/rev_2_2.dvi tests/rev_2_3.dvi \
+ tests/void.dvi tests/image.bmp tests/picbmp.bb \
+ tests/picbmp.xbb tests/image.jp2 tests/picjp2.bb \
+ tests/picjp2.xbb tests/image.jpeg tests/picjpeg.bb \
+ tests/picjpeg.xbb tests/image.png tests/picpng.bb \
+ tests/picpng.xbb tests/image.pdf tests/picpdf.bb \
+ tests/picpdf.xbb tests/bookm.dvi tests/bookm.tex \
+ tests/paper.dvi tests/paper.tex tests/ptex.dvi tests/resrc.dvi \
+ tests/resrc.tex tests/reverse.dvi tests/ttc.dvi tests/ttc.tex \
+ tests/test.ttc tests/fullmap.dvi tests/fullmap.tex
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -1801,8 +1805,9 @@ config.force: $(ZLIB_DEPEND) $(LIBPNG_DEPEND) $(KPATHSEA_DEPEND) $(LIBPAPER_DEPE
@LIBPNG_RULE@
@ZLIB_RULE@
@LIBPAPER_RULE@
-xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bb.log xdvipdfm-bkm.log xdvipdfm-psz.log \
- xdvipdfm-ptx.log xdvipdfm-res.log xdvipdfm-rev.log xdvipdfm-ttc.log: xdvipdfmx$(EXEEXT)
+xdvipdfmx.log xdvipdfm-ann.log xdvipdfm-bad.log xdvipdfm-bb.log \
+ xdvipdfm-bkm.log xdvipdfm-psz.log xdvipdfm-ptx.log xdvipdfm-res.log \
+ xdvipdfm-rev.log xdvipdfm-ttc.log: xdvipdfmx$(EXEEXT)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c
index 65824ee2aaf..27ddf4fc78c 100644
--- a/Build/source/texk/dvipdfm-x/dvi.c
+++ b/Build/source/texk/dvipdfm-x/dvi.c
@@ -319,7 +319,7 @@ static int pre_id_byte, post_id_byte, is_ptex = 0, has_ptex = 0;
static void
check_id_bytes (void) {
if (pre_id_byte != post_id_byte && (pre_id_byte != DVI_ID || post_id_byte != DVIV_ID))
- ERROR ("Inconsistent DVI id_bytes in preamble (%i) and postamble (%i)");
+ ERROR ("Inconsistent DVI id_bytes %d (pre) and %d (post)", pre_id_byte, post_id_byte);
}
static void
@@ -366,12 +366,6 @@ find_post (void)
post_id_byte = ch;
is_xdv = ch == XDV_ID;
is_ptex = ch == DVIV_ID;
- if (pre_id_byte) {
- check_id_bytes();
- if (has_ptex && !is_ptex) {
- ERROR ("DVI opcode %i only valid for Ascii pTeX", PTEXDIR);
- }
- }
/* Make sure post_post is really there */
current = current - 5;
@@ -387,6 +381,21 @@ find_post (void)
ERROR(invalid_signature);
}
+ /* Finally check the ID byte in the preamble */
+ /* An Ascii pTeX DVI file has id_byte DVI_ID in the preamble but DVIV_ID in the postamble. */
+ xseek_absolute (dvi_file, 0, "DVI");
+ if ((ch = get_unsigned_byte(dvi_file)) != PRE) {
+ MESG("Found %d where PRE was expected\n", ch);
+ ERROR(invalid_signature);
+ }
+ ch = get_unsigned_byte(dvi_file);
+ if (!(ch == DVI_ID || ch == XDV_ID)) {
+ MESG("DVI ID = %d\n", ch);
+ ERROR(invalid_signature);
+ }
+ pre_id_byte = ch;
+ check_id_bytes();
+
return current;
}
@@ -474,7 +483,7 @@ get_preamble_dvi_info (void)
ERROR(invalid_signature);
}
- /* A DVI file Ascii pTeX has id_byte DVI_ID in the preamble but DVIV_ID in the postamble. */
+ /* An Ascii pTeX DVI file has id_byte DVI_ID in the preamble but DVIV_ID in the postamble. */
ch = get_unsigned_byte(dvi_file);
if (!(ch == DVI_ID || ch == XDV_ID)) {
MESG("DVI ID = %d\n", ch);
@@ -483,10 +492,7 @@ get_preamble_dvi_info (void)
pre_id_byte = ch;
is_xdv = ch == XDV_ID;
- if (post_id_byte)
- check_id_bytes();
- else
- is_ptex = ch == DVI_ID; /* maybe */
+ is_ptex = ch == DVI_ID; /* maybe */
dvi_info.unit_num = get_positive_quad(dvi_file, "DVI", "unit_num");
dvi_info.unit_den = get_positive_quad(dvi_file, "DVI", "unit_den");
@@ -1598,24 +1604,26 @@ dvi_end_reflect (void)
}
static void
+skip_native_font_def (void)
+{
+ unsigned int flags;
+ int name_length;
+
+ skip_bytes(4, dvi_file); /* skip point size */
+ flags = get_unsigned_pair(dvi_file);
+ name_length = get_unsigned_byte(dvi_file);
+ skip_bytes(name_length + 4, dvi_file);
+ if (flags & XDV_FLAG_COLORED)
+ skip_bytes(4, dvi_file);
+ }
+
+static void
do_native_font_def (int32_t tex_id)
{
- if (linear) {
+ if (linear)
read_native_font_record(tex_id);
- } else {
- unsigned int flags;
- int name_length, i;
-
- get_unsigned_quad(dvi_file); /* skip point size */
- flags = get_unsigned_pair(dvi_file);
- name_length = (int) get_unsigned_byte(dvi_file);
- for (i = 0; i < name_length; ++i)
- get_unsigned_byte(dvi_file);
- get_unsigned_quad(dvi_file);
- if (flags & XDV_FLAG_COLORED) {
- get_unsigned_quad(dvi_file);
- }
- }
+ else
+ skip_native_font_def();
--dvi_page_buf_index; /* don't buffer the opcode */
}
@@ -1728,13 +1736,38 @@ do_glyphs (void)
return;
}
-/* Note to be absolutely certain that the string escape buffer doesn't
- * hit its limit, FORMAT_BUF_SIZE should set to 4 times S_BUFFER_SIZE
- * in pdfobj.c. Is there any application that genenerate words with
- * 1k characters?
- */
+static void
+check_postamble (void)
+{
+ int code;
+
+ skip_bytes(28, dvi_file);
+ while ((code = get_unsigned_byte(dvi_file)) != POST_POST) {
+ switch (code) {
+ case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4:
+ skip_bytes(code + 1 - FNT_DEF1, dvi_file);
+ skip_fntdef();
+ break;
+ case XDV_NATIVE_FONT_DEF:
+ skip_bytes(4, dvi_file);
+ skip_native_font_def();
+ break;
+ default:
+ ERROR("Unexpected op code (%u) in postamble", code);
+ }
+ }
+ skip_bytes(4, dvi_file);
+ post_id_byte = get_unsigned_byte(dvi_file);
+ if (!(post_id_byte == DVI_ID || post_id_byte == DVIV_ID || post_id_byte == XDV_ID)) {
+ MESG("DVI ID = %d\n", post_id_byte);
+ ERROR(invalid_signature);
+ }
+ check_id_bytes();
+ if (has_ptex && post_id_byte != DVIV_ID)
+ ERROR ("Saw opcode %i in DVI file not for Ascii pTeX", PTEXDIR);
-#define SBUF_SIZE 1024
+ num_pages = 0; /* force loop to terminate */
+}
/* Most of the work of actually interpreting
* the dvi file is here.
@@ -1798,6 +1831,12 @@ dvi_do_page (double page_paper_height, double hmargin, double vmargin)
break;
case EOP:
do_eop();
+ if (linear) {
+ if ((opcode = get_unsigned_byte(dvi_file)) == POST)
+ check_postamble();
+ else
+ ungetc(opcode, dvi_file);
+ }
return;
case PUSH:
@@ -1908,6 +1947,7 @@ dvi_init (char *dvi_filename, double mag)
int32_t post_location;
if (!dvi_filename) { /* no filename: reading from stdin, probably a pipe */
+ int ch;
#ifdef WIN32
setmode(fileno(stdin), _O_BINARY);
#endif
@@ -1916,6 +1956,10 @@ dvi_init (char *dvi_filename, double mag)
get_preamble_dvi_info();
do_scales(mag);
+ if ((ch = get_unsigned_byte(dvi_file)) == POST)
+ check_postamble();
+ else
+ ungetc(ch, dvi_file);
} else {
dvi_file = MFOPEN(dvi_filename, FOPEN_RBIN_MODE);
if (!dvi_file) {
@@ -2315,7 +2359,7 @@ dvi_scan_specials (int page_no,
static int buffered_page = -1;
unsigned int len;
- if (page_no == buffered_page)
+ if (page_no == buffered_page || num_pages == 0)
return; /* because dvipdfmx wants to scan first page twice! */
buffered_page = page_no;
diff --git a/Build/source/texk/dvipdfm-x/tests/ids_2_6.dvi b/Build/source/texk/dvipdfm-x/tests/ids_2_6.dvi
new file mode 100644
index 00000000000..952754daef7
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/ids_2_6.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/ids_3_2.dvi b/Build/source/texk/dvipdfm-x/tests/ids_3_2.dvi
new file mode 100644
index 00000000000..4f1c937c492
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/ids_3_2.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/ids_a_b.dvi b/Build/source/texk/dvipdfm-x/tests/ids_a_b.dvi
new file mode 100644
index 00000000000..1fb1523d2c4
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/ids_a_b.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/opc_fe.dvi b/Build/source/texk/dvipdfm-x/tests/opc_fe.dvi
new file mode 100644
index 00000000000..c3df8bf4517
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/opc_fe.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/ptx_2_2.dvi b/Build/source/texk/dvipdfm-x/tests/ptx_2_2.dvi
new file mode 100644
index 00000000000..d34a5070f83
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/ptx_2_2.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/ptx_6_6.dvi b/Build/source/texk/dvipdfm-x/tests/ptx_6_6.dvi
new file mode 100644
index 00000000000..19ed6ddb628
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/ptx_6_6.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/rev_2_2.dvi b/Build/source/texk/dvipdfm-x/tests/rev_2_2.dvi
new file mode 100644
index 00000000000..814322571bd
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/rev_2_2.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/rev_2_3.dvi b/Build/source/texk/dvipdfm-x/tests/rev_2_3.dvi
new file mode 100644
index 00000000000..35dd637304f
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/rev_2_3.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/void.dvi b/Build/source/texk/dvipdfm-x/tests/void.dvi
new file mode 100644
index 00000000000..7ec6d6c1be6
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/void.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfm-bad.test b/Build/source/texk/dvipdfm-x/xdvipdfm-bad.test
new file mode 100755
index 00000000000..7edba2d9c79
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/xdvipdfm-bad.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# Copyright (C) 2015 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+list="ids_2_6 ids_3_2 ids_a_b opc_fe ptx_2_2 ptx_6_6 rev_2_2 rev_2_3 void"
+
+for f in $list
+do
+
+echo "*** xdvipdfmx -v -z0 -o bad.pdf $f" && echo \
+ && ./xdvipdfmx -v -z0 -o bad.pdf $srcdir/tests/$f \
+ && failed="$failed xdvipdfmx-$f" \
+ || { echo && echo "xdvipdfmx-$f tests OK" && echo; }
+
+echo "*** xdvipdfmx -v -z0 -o bad.pdf <$f.dvi" && echo \
+ && ./xdvipdfmx -v -z0 -o bad.pdf <$srcdir/tests/$f.dvi \
+ && failed="$failed xdvipdfmx-$f (stdin)" \
+ || { echo && echo "xdvipdfmx-$f (stdin) tests OK" && echo; }
+
+done
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+