#! /bin/sh # # Copyright (C) 2012 Peter Breitenlohner # You may freely use, modify and/or distribute this file. usage () { echo "usage: $0 PDFTEX-ENGINE IMG" >&2 echo " test that pdfTeX can create PDF files with >2GB" >&2 echo " using various jpeg, png, jbig2, and pdf images" >&2 echo "" >&2 echo " where PDFTEX-ENGINE is the path to pdfTeX (or perhaps luaTeX)" >&2 echo "" >&2 echo " and IMG is jpeg-1, jpeg-2, or jpeg for both," >&2 echo " png-1, png-2, or png for both," >&2 echo " jbig2-1, jbig2-2, or jbig2 for both," >&2 echo " pdf, or all for all of them" >&2 exit 1 } test -n "$1" && test -x "$1" || usage dir=`dirname "$0"` TEXMFCNF=`cd "$dir" && pwd` export TEXMFCNF PDFTEX=`dirname "$1"`/`basename "$1"` echo testing "'$PDFTEX'" echo "$PDFTEX" -ini pdfimage || { echo could not create pdfimage format echo FAIL: pdfimage.test exit 1 } jpeg_1=jpg_200_1 jpeg_2=jpg_100_2_s png_1=png_140_1 png_2=png_70_2_s jbig2_1=jbig2_3000_1 jbig2_2=jbig2_1500_2_s pdf_1=jpg-200-1.pdf_1_1 case $2 in jpeg-1) list=$jpeg_1;; jpeg-2) list=$jpeg_2;; jpeg) list="$jpeg_1 $jpeg_2";; png-1) list=$png_1;; png-2) list=$png_2;; png) list="$png_1 $png_2";; jbig2-1) list=$jbig2_1;; jbig2-2) list=$jbig2_2;; jbig2) list="$jbig2_1 $jbig2_2";; pdf) list="$jpeg_1 $pdf_1";; all) list="$jpeg_1 $jpeg_2 $png_1 $png_2 $jbig2_1 $jbig2_2 $pdf_1";; *) usage;; esac exit_fail () { echo echo FAIL: pdfimage.test exit 1 } ls_list= test_one () { file=image.$1-$2-$3 echo "testing $file" if "$PDFTEX" -fmt=pdfimage -jobname=$file pdfimage; then if grep "^Output written.*($3 page$4," $file.log >/dev/null; then ls_list="$ls_list `ls -lh $file.pdf`" else exit_fail fi else exit_fail fi } for l in $list; do test_one `echo $l | tr '_' ' '` done echo echo "$ls_list" echo PASS: pdfimage.test rm -f pdfimage.fmt pdfimage.log