summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-08-02 08:12:45 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-08-02 08:12:45 +0000
commit8c3b2cf8304d91f7bd5b9240c3b6683aacab3b32 (patch)
tree2253c3372faaa39351dfccaefdfb3621579d0bb6
parentf33eb0484cbe25aa606b58e4eb8e68c795607fb2 (diff)
dvipdfm-x: Bug fixes and additional test cases
git-svn-id: svn://tug.org/texlive/trunk@31330 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog11
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.am3
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.in5
-rwxr-xr-xBuild/source/texk/dvipdfm-x/configure20
-rw-r--r--Build/source/texk/dvipdfm-x/configure.ac8
-rw-r--r--Build/source/texk/dvipdfm-x/dvi.c2
-rwxr-xr-xBuild/source/texk/dvipdfm-x/dvipdfm-bb.test19
-rwxr-xr-xBuild/source/texk/dvipdfm-x/dvipdfmx.test14
-rw-r--r--Build/source/texk/dvipdfm-x/pdfobj.c4
-rw-r--r--Build/source/texk/dvipdfm-x/tests/image.dvibin0 -> 388 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/image.tex23
-rw-r--r--Build/source/texk/dvipdfm-x/xbb.c145
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfm-bb.test19
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfmx.test19
14 files changed, 107 insertions, 185 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 3d839adbcdc..fea798b1cd3 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,14 @@
+2013-08-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * pdfobj.c (pdf_open): Bugfix: Always set pf->catalog.
+ * xbb.c: Use same code to get the .pdf bounding box in dvipdfmx
+ and xdvipdfmx.
+ * dvi.c: Avoid duplicate page number output, e.g., "[1[1]]".
+ * (x)dvipdfmx.test: Add test with image files.
+ * tests/image.tex, tests/image.tex: Additional test input files.
+ * Makefile.am (EXTRA_DIST, DISTCLEANFILES): More test IO files.
+ Define PACKAGE as "dvipdfmx" for kpse_reset_program_name().
+
2013-07-29 Peter Breitenlohner <peb@mppmu.mpg.de>
* Removed diffs between src/ and xsrc/ version of the remaining
diff --git a/Build/source/texk/dvipdfm-x/Makefile.am b/Build/source/texk/dvipdfm-x/Makefile.am
index 4533b562f97..2df80918ece 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.am
+++ b/Build/source/texk/dvipdfm-x/Makefile.am
@@ -285,5 +285,6 @@ EXTRA_DIST += tests/dvipdfmx.cfg
EXTRA_DIST += tests/image.jpeg tests/imgjpeg.bb tests/imgjpeg.xbb tests/picjpeg.bb tests/picjpeg.xbb
EXTRA_DIST += tests/image.pdf tests/imgpdf.bb tests/imgpdf.xbb tests/picpdf.bb tests/picpdf.xbb
EXTRA_DIST += tests/image.png tests/imgpng.bb tests/imgpng.xbb tests/picpng.bb tests/picpng.xbb
-DISTCLEANFILES += img*.* pic*.*
+EXTRA_DIST += tests/image.dvi tests/image.tex
+DISTCLEANFILES += img*.* pic*.* image*.pdf
diff --git a/Build/source/texk/dvipdfm-x/Makefile.in b/Build/source/texk/dvipdfm-x/Makefile.in
index 9e5ab7c1622..f41eedff044 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.in
+++ b/Build/source/texk/dvipdfm-x/Makefile.in
@@ -831,7 +831,7 @@ 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 img*.* pic*.*
+DISTCLEANFILES = config.force img*.* pic*.* image*.pdf
TESTS = $(am__append_5) $(am__append_6)
dvipdfmx_tests = dvipdfmx.test dvipdfm-bb.test
xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-bb.test
@@ -840,7 +840,8 @@ EXTRA_DIST = $(dvipdfmx_tests) $(xdvipdfmx_tests) tests/dvipdfmx.cfg \
tests/picjpeg.bb tests/picjpeg.xbb tests/image.pdf \
tests/imgpdf.bb tests/imgpdf.xbb tests/picpdf.bb \
tests/picpdf.xbb tests/image.png tests/imgpng.bb \
- tests/imgpng.xbb tests/picpng.bb tests/picpng.xbb
+ tests/imgpng.xbb tests/picpng.bb tests/picpng.xbb \
+ tests/image.dvi tests/image.tex
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/Build/source/texk/dvipdfm-x/configure b/Build/source/texk/dvipdfm-x/configure
index aa840b7cf8e..5cefc649821 100755
--- a/Build/source/texk/dvipdfm-x/configure
+++ b/Build/source/texk/dvipdfm-x/configure
@@ -7888,15 +7888,6 @@ fi
VERSION='20130624'
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
@@ -13215,6 +13206,17 @@ test "x$enable_dvipdfm_x:$enable_xdviodfm" = xyes:yes && need_freetype2=yes
ac_config_headers="$ac_config_headers config.h"
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "dvipdfmx"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "20130624"
+_ACEOF
+
+
# Check whether --enable-libtool-hack was given.
if test "${enable_libtool_hack+set}" = set; then :
enableval=$enable_libtool_hack;
diff --git a/Build/source/texk/dvipdfm-x/configure.ac b/Build/source/texk/dvipdfm-x/configure.ac
index e274903c8e3..5bf99589e79 100644
--- a/Build/source/texk/dvipdfm-x/configure.ac
+++ b/Build/source/texk/dvipdfm-x/configure.ac
@@ -6,19 +6,23 @@ dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-AC_INIT([dvipdfm-x (TeX Live)], [20130624], [tex-k@tug.org])
+m4_define([dvipdfmx_version], [20130624])
+AC_INIT([dvipdfm-x (TeX Live)], dvipdfmx_version, [tex-k@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([agl.c])
AC_CONFIG_AUX_DIR([../../build-aux])
AC_CONFIG_MACRO_DIR([../../m4])
dnl Common code for all programs using libkpathsea.
-KPSE_COMMON([dvipdfm-x])
+KPSE_COMMON([dvipdfm-x], [no-define])
m4_include([ac/dvipdfm-x.ac])
AC_CONFIG_HEADERS([config.h])
+AC_DEFINE_UNQUOTED([PACKAGE], ["dvipdfmx"], [Name of package])
+AC_DEFINE_UNQUOTED([VERSION], ["]dvipdfmx_version["], [Version number of package])
+
KPSE_LT_HACK
dnl Checks for header files.
diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c
index a0a271591ea..6a51e118776 100644
--- a/Build/source/texk/dvipdfm-x/dvi.c
+++ b/Build/source/texk/dvipdfm-x/dvi.c
@@ -2140,11 +2140,9 @@ dvi_do_page (long n,
case BOP:
do_bop();
- MESG("[%d", n+1);
break;
case EOP:
do_eop();
- MESG("]");
return;
case PUSH:
diff --git a/Build/source/texk/dvipdfm-x/dvipdfm-bb.test b/Build/source/texk/dvipdfm-x/dvipdfm-bb.test
index ba9f9017d0d..646d26aa98d 100755
--- a/Build/source/texk/dvipdfm-x/dvipdfm-bb.test
+++ b/Build/source/texk/dvipdfm-x/dvipdfm-bb.test
@@ -19,41 +19,44 @@ done
echo "*** dvipdfmx --ebb --version" \
&& ./dvipdfmx --ebb --version \
- && echo "ebb-version tests OK" && echo \
+ && echo && echo "ebb-version tests OK" && echo \
|| failed="$failed ebb-version"
echo "*** dvipdfmx --ebb --help" \
&& ./dvipdfmx --ebb --help \
- && echo "ebb-help tests OK" && echo \
+ && echo && echo "ebb-help tests OK" && echo \
|| failed="$failed ebb-help"
for e in jpeg png pdf; do
- ./dvipdfmx --ebb -O img$e.$e \
+ echo "*** dvipdfmx --ebb img$e.$e" \
+ && ./dvipdfmx --ebb -O img$e.$e \
| sed '/%%CreationDate/d' >img$e.bb \
&& diff $testsrc/img$e.bb img$e.bb \
- && echo "ebb-$e tests OK" \
+ && echo && echo "ebb-$e tests OK" && echo \
|| failed="$failed ebb-$e"
done
echo "*** dvipdfmx --xbb --version" \
&& ./dvipdfmx --xbb --version \
- && echo "xbb-version tests OK" && echo \
+ && echo && echo "xbb-version tests OK" && echo \
|| failed="$failed xbb-version"
echo "*** dvipdfmx --xbb --help" \
&& ./dvipdfmx --xbb --help \
- && echo "xbb-help tests OK" && echo \
+ && echo && echo "xbb-help tests OK" && echo \
|| failed="$failed xbb-help"
for e in jpeg png pdf; do
- ./dvipdfmx --xbb -O img$e.$e \
+ echo "*** dvipdfmx --xbb img$e.$e" \
+ && ./dvipdfmx --xbb -O img$e.$e \
| sed '/%%CreationDate/d' >img$e.xbb \
&& diff $testsrc/img$e.xbb img$e.xbb \
- && echo "xbb-$e tests OK" \
+ && echo && echo "xbb-$e tests OK" && echo \
|| failed="$failed xbb-$e"
done
test -z "$failed" && exit 0
+echo
echo "failed tests:$failed"
exit 1
diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.test b/Build/source/texk/dvipdfm-x/dvipdfmx.test
index a46ff272355..fa70743f7b7 100755
--- a/Build/source/texk/dvipdfm-x/dvipdfmx.test
+++ b/Build/source/texk/dvipdfm-x/dvipdfmx.test
@@ -6,22 +6,30 @@
# Not really a test, just making sure the program executes.
TEXMFCNF=${srcdir}/../kpathsea
+TEXFONTS=${srcdir}/data
DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-export TEXMFCNF DVIPDFMXINPUTS
+TEXPICTS=${srcdir}/tests
+export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
failed=
echo "*** dvipdfmx --version" \
&& ./dvipdfmx --version \
- && echo "dvipdfmx-version tests OK" && echo \
+ && echo && echo "dvipdfmx-version tests OK" && echo \
|| failed="$failed dvipdfmx-version"
echo "*** dvipdfmx --help" \
&& ./dvipdfmx --help \
- && echo "dvipdfmx-help tests OK" && echo \
+ && echo && echo "dvipdfmx-help tests OK" && echo \
|| failed="$failed dvipdfmx-help"
+echo "*** dvipdfmx -v -o image1.pdf image" && echo \
+ && ./dvipdfmx -v -o image1.pdf ${srcdir}/tests/image \
+ && echo && echo "dvipdfmx-image tests OK" && echo \
+ || failed="$failed dvipdfmx-image"
+
test -z "$failed" && exit 0
+echo
echo "failed tests:$failed"
exit 1
diff --git a/Build/source/texk/dvipdfm-x/pdfobj.c b/Build/source/texk/dvipdfm-x/pdfobj.c
index 81537f699f2..bca5bb2ad8e 100644
--- a/Build/source/texk/dvipdfm-x/pdfobj.c
+++ b/Build/source/texk/dvipdfm-x/pdfobj.c
@@ -3044,9 +3044,7 @@ pdf_open (const char *ident, FILE *file)
if (pf) {
pf->file = file;
} else {
-#ifndef XETEX
pdf_obj *new_version;
-#endif
int version = check_for_pdf_version(file);
if (version < 1 || version > pdf_version) {
@@ -3060,7 +3058,6 @@ pdf_open (const char *ident, FILE *file)
if (!(pf->trailer = read_xref(pf)))
goto error;
-#ifndef XETEX
if (pdf_lookup_dict(pf->trailer, "Encrypt")) {
WARN("PDF document is encrypted.");
goto error;
@@ -3088,7 +3085,6 @@ pdf_open (const char *ident, FILE *file)
pdf_release_obj(new_version);
}
-#endif
if (ident)
ht_append_table(pdf_files, ident, strlen(ident), pf);
diff --git a/Build/source/texk/dvipdfm-x/tests/image.dvi b/Build/source/texk/dvipdfm-x/tests/image.dvi
new file mode 100644
index 00000000000..5fa697608d1
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/image.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/image.tex b/Build/source/texk/dvipdfm-x/tests/image.tex
new file mode 100644
index 00000000000..e0514f46b2b
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/image.tex
@@ -0,0 +1,23 @@
+%
+\shipout\vbox{
+\vbox to5cm{}
+\special{pdf:image @jpegpic (image.jpeg)}
+\special{pdf:uxobj @jpegpic}
+}
+\advance\count0 by 1
+%
+\shipout\vbox{
+\vbox to5cm{}
+\special{pdf:image @pngpic (image.png)}
+\special{pdf:uxobj @pngpic}
+}
+\advance\count0 by 1
+%
+\shipout\vbox{
+\vbox to5cm{}
+\special{pdf:image @pdfpic (image.pdf)}
+\special{pdf:uxobj @pdfpic}
+}
+\advance\count0 by 1
+%
+\bye
diff --git a/Build/source/texk/dvipdfm-x/xbb.c b/Build/source/texk/dvipdfm-x/xbb.c
index 411048a09f2..774bd320afc 100644
--- a/Build/source/texk/dvipdfm-x/xbb.c
+++ b/Build/source/texk/dvipdfm-x/xbb.c
@@ -44,11 +44,10 @@
#include "dvipdfmx.h"
#define XBB_PROGRAM "extractbb"
-#define XBB_VERSION VERSION
static void show_version(void)
{
- fprintf (stdout, "\nThis is " XBB_PROGRAM " Version " XBB_VERSION "\n");
+ fprintf (stdout, "\nThis is " XBB_PROGRAM " Version " VERSION "\n");
fprintf (stdout, "A bounding box extraction utility from PDF, PNG, and JPEG.\n");
fprintf (stdout, "\nCopyright (C) 2008-2013 by Jin-Hwan Cho and Matthias Franz\n");
fprintf (stdout, "\nThis is free software; you can redistribute it and/or modify\n");
@@ -147,7 +146,7 @@ static void write_xbb(char *fname,
}
fprintf(fp, "%%%%Title: %s\n", fname);
- fprintf(fp, "%%%%Creator: %s %s\n", XBB_PROGRAM, XBB_VERSION);
+ fprintf(fp, "%%%%Creator: %s %s\n", XBB_PROGRAM, VERSION);
fprintf(fp, "%%%%BoundingBox: %ld %ld %ld %ld\n", bbllx, bblly, bburx, bbury);
if (!compat_mode) {
@@ -204,145 +203,6 @@ static void do_png (FILE *fp, char *filename)
}
#endif /* HAVE_LIBPNG */
-#ifdef XETEX
-static int rect_equal (pdf_obj *rect1, pdf_obj *rect2)
-{
- int i;
- if (!rect1 || !rect2) return 0;
- for (i = 0; i < 4; i++) {
- if (pdf_number_value(pdf_get_array(rect1, i)) != pdf_number_value(pdf_get_array(rect2, i))) return 0;
- }
- return 1;
-}
-
-static int pdf_get_info (FILE *image_file, char *filename, int *version,
- double *llx, double *lly, double *urx, double *ury)
-{
- pdf_obj *page_tree;
- pdf_obj *bbox;
- pdf_file *pf;
-
- page_tree = NULL;
- {
- pdf_obj *trailer, *catalog;
-
- pf = pdf_open(filename, image_file);
- if (!pf)
- return -1;
-
- trailer = pdf_file_get_trailer(pf);
-
- if (pdf_lookup_dict(trailer, "Encrypt")) {
- WARN("This PDF document is encrypted.");
- pdf_release_obj(trailer);
- pdf_close(pf);
- return -1;
- }
- catalog = pdf_deref_obj(pdf_lookup_dict(trailer, "Root"));
- if (!catalog) {
- WARN("Catalog isn't where I expect it.");
- pdf_close(pf);
- return -1;
- }
- pdf_release_obj(trailer);
- page_tree = pdf_deref_obj(pdf_lookup_dict(catalog, "Pages"));
- pdf_release_obj(catalog);
- }
- if (!page_tree) {
- WARN("Page tree not found.");
- pdf_close(pf);
- return -1;
- }
- {
- pdf_obj *kids_ref, *kids;
- pdf_obj *crop_box;
- pdf_obj *tmp;
-
- tmp = pdf_lookup_dict(page_tree, "MediaBox");
- bbox = tmp ? pdf_deref_obj(tmp) : NULL;
- tmp = pdf_lookup_dict(page_tree, "CropBox");
- crop_box = tmp ? pdf_deref_obj(tmp) : NULL;
-
- while ((kids_ref = pdf_lookup_dict(page_tree, "Kids")) != NULL) {
- kids = pdf_deref_obj(kids_ref);
- pdf_release_obj(page_tree);
- page_tree = pdf_deref_obj(pdf_get_array(kids, 0));
- pdf_release_obj(kids);
-
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "MediaBox")))) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "BleedBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "TrimBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "ArtBox")))) {
- if (!rect_equal(tmp, bbox)) {
- if (bbox)
- pdf_release_obj(bbox);
- bbox = tmp;
- } else
- pdf_release_obj(tmp);
- }
- if ((tmp = pdf_deref_obj(pdf_lookup_dict(page_tree, "CropBox")))) {
- if (crop_box)
- pdf_release_obj(crop_box);
- crop_box = tmp;
- }
- }
- if (crop_box) {
- pdf_release_obj(bbox);
- bbox = crop_box;
- }
- }
- pdf_release_obj(page_tree);
-
- if (!bbox) {
- WARN("No BoundingBox information available.");
- pdf_close(pf);
- return -1;
- }
-
- *version = pdf_file_get_version(pf);
-
- *llx = pdf_number_value(pdf_get_array(bbox, 0));
- *lly = pdf_number_value(pdf_get_array(bbox, 1));
- *urx = pdf_number_value(pdf_get_array(bbox, 2));
- *ury = pdf_number_value(pdf_get_array(bbox, 3));
-
- pdf_release_obj(bbox);
-
- pdf_close(pf);
- return 0;
-}
-
-static void do_pdf (FILE *fp, char *filename)
-{
- double llx, lly, urx, ury;
- int version;
-
- if (pdf_get_info(fp, filename, &version, &llx, &lly, &urx, &ury) < 0) {
- fprintf (stderr, "%s does not look like a PDF file...\n", filename);
- return;
- }
- write_xbb(filename, llx, lly, urx, ury, version, 1);
- return;
-}
-#else
static void do_pdf (FILE *fp, char *filename)
{
pdf_obj *page;
@@ -368,7 +228,6 @@ static void do_pdf (FILE *fp, char *filename)
write_xbb(filename, bbox.llx, bbox.lly, bbox.urx, bbox.ury,
pdf_file_get_version(pf), count);
}
-#endif
int extractbb (int argc, char *argv[])
{
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfm-bb.test b/Build/source/texk/dvipdfm-x/xdvipdfm-bb.test
index 77756d36931..955b98eec41 100755
--- a/Build/source/texk/dvipdfm-x/xdvipdfm-bb.test
+++ b/Build/source/texk/dvipdfm-x/xdvipdfm-bb.test
@@ -19,41 +19,44 @@ done
echo "*** xdvipdfmx --ebb --version" \
&& ./xdvipdfmx --ebb --version \
- && echo "ebb-version tests OK" && echo \
+ && echo && echo "ebb-version tests OK" && echo \
|| failed="$failed ebb-version"
echo "*** xdvipdfmx --ebb --help" \
&& ./xdvipdfmx --ebb --help \
- && echo "ebb-help tests OK" && echo \
+ && echo && echo "ebb-help tests OK" && echo \
|| failed="$failed ebb-help"
for e in jpeg png pdf; do
- ./xdvipdfmx --ebb pic$e.$e \
+ echo "*** xdvipdfmx --ebb pic$e.$e" \
+ && ./xdvipdfmx --ebb pic$e.$e \
&& sed '/%%CreationDate/d' pic$e.bb >pic$e.bbx \
&& diff $testsrc/pic$e.bb pic$e.bbx \
- && echo "ebb-$e tests OK" \
+ && echo && echo "ebb-$e tests OK" && echo \
|| failed="$failed ebb-$e"
done
echo "*** xdvipdfmx --xbb --version" \
&& ./xdvipdfmx --xbb --version \
- && echo "xbb-version tests OK" && echo \
+ && echo && echo "xbb-version tests OK" && echo \
|| failed="$failed xbb-version"
echo "*** xdvipdfmx --xbb --help" \
&& ./xdvipdfmx --xbb --help \
- && echo "xbb-help tests OK" && echo \
+ && echo && echo "xbb-help tests OK" && echo \
|| failed="$failed xbb-help"
for e in jpeg png pdf; do
- ./xdvipdfmx --xbb pic$e.$e \
+ echo "*** xdvipdfmx --xbb img$e.$e" \
+ && ./xdvipdfmx --xbb pic$e.$e \
&& sed '/%%CreationDate/d' pic$e.xbb >pic$e.xbbx \
&& diff $testsrc/pic$e.xbb pic$e.xbbx \
- && echo "xbb-$e tests OK" \
+ && echo && echo "xbb-$e tests OK" && echo \
|| failed="$failed xbb-$e"
done
test -z "$failed" && exit 0
+echo
echo "failed tests:$failed"
exit 1
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfmx.test b/Build/source/texk/dvipdfm-x/xdvipdfmx.test
index 0facea9c040..2d1fd473957 100755
--- a/Build/source/texk/dvipdfm-x/xdvipdfmx.test
+++ b/Build/source/texk/dvipdfm-x/xdvipdfmx.test
@@ -6,22 +6,35 @@
# Not really a test, just making sure the program executes.
TEXMFCNF=${srcdir}/../kpathsea
+TEXFONTS=${srcdir}/data
DVIPDFMXINPUTS=${srcdir}/tests:${srcdir}/data
-export TEXMFCNF DVIPDFMXINPUTS
+TEXPICTS=${srcdir}/tests
+export TEXMFCNF TEXFONTS DVIPDFMXINPUTS TEXPICTS
failed=
echo "*** xdvipdfmx --version" \
&& ./xdvipdfmx --version \
- && echo "xdvipdfmx-version tests OK" && echo \
+ && echo && echo "xdvipdfmx-version tests OK" && echo \
|| failed="$failed xdvipdfmx-version"
echo "*** xdvipdfmx --help" \
&& ./xdvipdfmx --help \
- && echo "xdvipdfmx-help tests OK" && echo \
+ && echo && echo "xdvipdfmx-help tests OK" && echo \
|| failed="$failed xdvipdfmx-help"
+# This test can fail (why?) and is skipped unless XDVIPDFMX_IMAGE is non-empty.
+if test -z "$XDVIPDFMX_IMAGE"; then :; else
+
+echo "*** xdvipdfmx -v -o image2.pdf image" && echo \
+ && ./xdvipdfmx -v -o image2.pdf ${srcdir}/tests/image \
+ && echo && echo "xdvipdfmx-image tests OK" && echo \
+ || failed="$failed xdvipdfmx-image"
+
+fi
+
test -z "$failed" && exit 0
+echo
echo "failed tests:$failed"
exit 1