From 48c7c92c5f1f9acf0da43e9a6aef3e032b89eb8c Mon Sep 17 00:00:00 2001 From: vog Date: Thu, 23 Jun 2011 11:12:21 +0000 Subject: [PATCH] #776: Unified the mechanism by which the test drivers look for binaries (exiv2, samples, etc.), added support for EXIV2_BINDIR, removed the call to "which exiv2" --- test/addmoddel.sh | 13 ++- test/bugfixes-test.sh | 129 +++++++++++++------------ test/conversions.sh | 198 ++++++++++++++++++++------------------- test/crw-test.sh | 25 +++-- test/data/exiv2-test.out | 1 - test/eps-test.sh | 22 +++-- test/exifdata-test.sh | 14 ++- test/exiv2-test.sh | 41 ++++---- test/imagetest.sh | 17 ++-- test/iotest.sh | 11 ++- test/iptctest.sh | 22 +++-- test/modify-test.sh | 15 ++- test/path-test.sh | 11 ++- test/stringto-test.sh | 10 +- test/tiff-test.sh | 11 ++- test/write-test.sh | 12 ++- test/write2-test.sh | 10 +- test/xmpparser-test.sh | 42 +++++---- 18 files changed, 348 insertions(+), 256 deletions(-) diff --git a/test/addmoddel.sh b/test/addmoddel.sh index 8c4f0a28..4d49d44b 100755 --- a/test/addmoddel.sh +++ b/test/addmoddel.sh @@ -10,12 +10,17 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -binpath="$VALGRIND ../../samples" -exiv2="$VALGRIND exiv2" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cp -f ./data/exiv2-empty.jpg ./tmp cd ./tmp -$binpath/addmoddel exiv2-empty.jpg -$exiv2 -pv exiv2-empty.jpg +$samples/addmoddel exiv2-empty.jpg +$bin/exiv2 -pv exiv2-empty.jpg ) > $results diff -q $diffargs $results $good diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index 8359057d..c6ec1c38 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -14,172 +14,177 @@ prep_file() } ( -binpath="$VALGRIND ../../samples" -exiv2="$VALGRIND exiv2 -u" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cd ./tmp num=426 filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=440 filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=443 filename=`prep_file $num` -$exiv2 -b -pt $filename +$bin/exiv2 -u -b -pt $filename num=444 filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=445 filename=`prep_file $num` -$exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename -$exiv2 -b -pt $filename +$bin/exiv2 -u -v -M'set Exif.Photo.UserComment A comment' $filename +$bin/exiv2 -u -b -pt $filename filename=exiv2-empty.jpg cp -f ../data/$filename . -$exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename -$exiv2 -b -pt $filename +$bin/exiv2 -u -v -M'set Exif.Photo.UserComment A comment' $filename +$bin/exiv2 -u -b -pt $filename num=447 # Problem only visible in Valgrind filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=452 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename -$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude SRational -1/3 -2/3 -3/3" $filename -$exiv2 -pv $filename -$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude Rational 1/3 2/3 3/3" $filename -$exiv2 -pv $filename +$bin/exiv2 -u -v -M"set Exif.GPSInfo.GPSLatitude SRational -1/3 -2/3 -3/3" $filename +$bin/exiv2 -u -pv $filename +$bin/exiv2 -u -v -M"set Exif.GPSInfo.GPSLatitude Rational 1/3 2/3 3/3" $filename +$bin/exiv2 -u -pv $filename num=460 filename=`prep_file $num` -$exiv2 -pt $filename +$bin/exiv2 -u -pt $filename num=479 filename=`prep_file $num` -$exiv2 -pt $filename +$bin/exiv2 -u -pt $filename num=480 filename=`prep_file $num` -$binpath/largeiptc-test $filename ../data/imagemagick.png +$samples/largeiptc-test $filename ../data/imagemagick.png num=495 filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=498 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename -$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude 0/1 1/1 2/1" $filename -$exiv2 -v -pv $filename -$exiv2 -v -M"del Exif.GPSInfo.GPSLatitude" $filename -$exiv2 -v -pv $filename +$bin/exiv2 -u -v -M"set Exif.GPSInfo.GPSLatitude 0/1 1/1 2/1" $filename +$bin/exiv2 -u -v -pv $filename +$bin/exiv2 -u -v -M"del Exif.GPSInfo.GPSLatitude" $filename +$bin/exiv2 -u -v -pv $filename num=501 filename=`prep_file $num` -$exiv2 -pi $filename +$bin/exiv2 -u -pi $filename num=528 filename=`prep_file $num` -$exiv2 -pt $filename -$exiv2 -v -M"set Exif.Image.Software GI" $filename +$bin/exiv2 -u -pt $filename +$bin/exiv2 -u -v -M"set Exif.Image.Software GI" $filename num=540 filename=`prep_file $num` -$exiv2 -px $filename +$bin/exiv2 -u -px $filename num=554 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename echo '------>' Bug $num '<-------' >&2 -$exiv2 -v -M"set Exif.Image.DateTime Date 2007-05-27" $filename -$exiv2 -pt $filename +$bin/exiv2 -u -v -M"set Exif.Image.DateTime Date 2007-05-27" $filename +$bin/exiv2 -u -pt $filename num=662 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename echo '------>' Bug $num '<-------' >&2 -$exiv2 -M"set Exif.Photo.UserComment charset=Ascii An ascii comment" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Ascii An ascii comment" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Ascii A\\nnewline" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Ascii A\\nnewline" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode A Unicode comment" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode A Unicode comment" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode \\u01c4" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode \\u01c4" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode A\\u01c4C" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode A\\u01c4C" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode With\\nNewline" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode With\\nNewline" $filename +$bin/exiv2 -u -PEnh $filename -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode With\\tTab" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode With\\tTab" $filename +$bin/exiv2 -u -PEnh $filename # Test invalid escape sequences -$exiv2 -M"set Exif.Photo.UserComment charset=Unicode \\ugggg" $filename -$exiv2 -PEnh $filename +$bin/exiv2 -u -M"set Exif.Photo.UserComment charset=Unicode \\ugggg" $filename +$bin/exiv2 -u -PEnh $filename num=666 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename echo '------>' Bug $num '<-------' >&2 -$exiv2 -v -M'set Exif.Image.Make NIKON' \ +$bin/exiv2 -u -v -M'set Exif.Image.Make NIKON' \ -M'set Exif.Image.Model D90' \ -M'set Exif.Nikon3.ShutterCount 100' \ -M'set Exif.Nikon3.SerialNumber 123' \ -M'set Exif.NikonSi02xx.Version 48 50 51 52' \ -M'set Exif.NikonSi02xx.ShutterCount 100' $filename -$exiv2 -pa -u -b $filename +$bin/exiv2 -u -pa -u -b $filename num=683 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-nikon-d70.jpg $filename echo '------>' Bug $num '<-------' >&2 -$exiv2 -v -f -r %Y-%m-%d-%a-%j $filename +$bin/exiv2 -u -v -f -r %Y-%m-%d-%a-%j $filename num=711 # Little endian (II) filename=exiv2-bug${num}-1.jpg cp -f ../data/exiv2-empty.jpg $filename echo '------>' Bug $num '<-------' >&2 -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Initial values, read from the command line' \ +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Initial values, read from the command line' \ -M'set Exif.Image.DocumentName Float 0.12345' \ -M'set Exif.Image.ImageDescription Double 0.987654321' $filename -$exiv2 -v -PEkyct $filename -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Non-intrusive update' $filename -$exiv2 -v -PEkyct $filename -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Intrusive update, writing the structure from scratch' $filename -$exiv2 -v -PEkyct $filename +$bin/exiv2 -u -v -PEkyct $filename +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Non-intrusive update' $filename +$bin/exiv2 -u -v -PEkyct $filename +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Intrusive update, writing the structure from scratch' $filename +$bin/exiv2 -u -v -PEkyct $filename # Big endian (MM) filename=exiv2-bug${num}-2.jpg cp -f ../data/exiv2-kodak-dc210.jpg $filename -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Initial values, read from the command line' \ +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Initial values, read from the command line' \ -M'set Exif.Image.DocumentName Float 0.12345' \ -M'set Exif.Image.ImageDescription Double 0.987654321' $filename -$exiv2 -v -PEkyct $filename -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Non-intrusive update' $filename -$exiv2 -v -PEkyct $filename -$exiv2 -v -M'set Exif.Image.ProcessingSoftware Intrusive update, writing the structure from scratch' $filename -$exiv2 -v -PEkyct $filename +$bin/exiv2 -u -v -PEkyct $filename +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Non-intrusive update' $filename +$bin/exiv2 -u -v -PEkyct $filename +$bin/exiv2 -u -v -M'set Exif.Image.ProcessingSoftware Intrusive update, writing the structure from scratch' $filename +$bin/exiv2 -u -v -PEkyct $filename # Test easy-access keys (using a dummy bug number) num=726 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename -$exiv2 -v -M"set Exif.Image.Make Samsung" $filename -$binpath/easyaccess-test $filename +$bin/exiv2 -u -v -M"set Exif.Image.Make Samsung" $filename +$samples/easyaccess-test $filename ) > $results 2>&1 diff --git a/test/conversions.sh b/test/conversions.sh index ae9a447d..2ded7191 100755 --- a/test/conversions.sh +++ b/test/conversions.sh @@ -1,38 +1,42 @@ #! /bin/sh # XMP parser test driver +# ---------------------------------------------------------------------- +# Setup +export LC_ALL=C +results="./conversions.out" +good="../data/conversions.out" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi +cd ./tmp + # ---------------------------------------------------------------------- # Check if xmpparser-test exists -if [ ! -e ../samples/xmpparser-test ] ; then +if [ ! -e ../../samples/xmpparser-test -a ! -e "$EXIV2_BINDIR/xmpparser-test" ] ; then echo "xmpparser-test not found. Assuming XMP support is not enabled." exit 0 fi -# ---------------------------------------------------------------------- -# Setup -export LC_ALL=C -results="./tmp/conversions.out" -good="./data/conversions.out" - # ---------------------------------------------------------------------- # Main routine ( -binpath="$VALGRIND ../../samples" -exiv2="$VALGRIND exiv2" -cd ./tmp - IMG=../data/exiv2-empty.jpg # 1) Convert Exif ImageDescription to XMP x-default langAlt value echo Testcase 1 echo ========== \cp $IMG h.jpg -$exiv2 -M'set Exif.Image.ImageDescription The Exif image description' h.jpg +$bin/exiv2 -M'set Exif.Image.ImageDescription The Exif image description' h.jpg rm -f h.xmp -$exiv2 -eX h.jpg -$exiv2 -px h.xmp -$exiv2 -PEkycv h.xmp -$exiv2 -pi h.xmp +$bin/exiv2 -eX h.jpg +$bin/exiv2 -px h.xmp +$bin/exiv2 -PEkycv h.xmp +$bin/exiv2 -pi h.xmp # 2) Convert XMP x-default langAlt value back to Exif ImageDescription echo @@ -40,10 +44,10 @@ echo Testcase 2 echo ========== \cp $IMG i.jpg \cp h.xmp i.xmp -$exiv2 -iX i.jpg -$exiv2 -px i.jpg -$exiv2 -PEkycv i.jpg -$exiv2 -pi i.jpg +$bin/exiv2 -iX i.jpg +$bin/exiv2 -px i.jpg +$bin/exiv2 -PEkycv i.jpg +$bin/exiv2 -pi i.jpg # 3) Convert XMP single non-x-default langAlt value to Exif ImageDescription echo @@ -51,10 +55,10 @@ echo Testcase 3 echo ========== sed s/x-default/de-DE/ i.xmp > j.xmp \cp $IMG j.jpg -$exiv2 -iX j.jpg -$exiv2 -px j.jpg -$exiv2 -PEkycv j.jpg -$exiv2 -pi j.jpg +$bin/exiv2 -iX j.jpg +$bin/exiv2 -px j.jpg +$bin/exiv2 -PEkycv j.jpg +$bin/exiv2 -pi j.jpg # 4) This shouldn't work: No x-default, more than one language echo @@ -62,36 +66,36 @@ echo Testcase 4 echo ========== sed 's,The Exif image description,The Exif image descriptionCiao bella,' j.xmp > k.xmp \cp $IMG k.jpg -$exiv2 -iX k.jpg -$exiv2 -px k.jpg -$exiv2 -v -PEkycv k.jpg -$exiv2 -v -pi k.jpg +$bin/exiv2 -iX k.jpg +$bin/exiv2 -px k.jpg +$bin/exiv2 -v -PEkycv k.jpg +$bin/exiv2 -v -pi k.jpg # 5) Add a default language to the XMP file and convert to Exif and IPTC echo echo Testcase 5 echo ========== \cp k.xmp l.xmp -$exiv2 -M'set Xmp.dc.description lang="x-default" How to fix this mess' l.xmp +$bin/exiv2 -M'set Xmp.dc.description lang="x-default" How to fix this mess' l.xmp grep x-default l.xmp \cp $IMG l.jpg -$exiv2 -iX l.jpg -$exiv2 -px l.jpg -$exiv2 -PEkycv l.jpg -$exiv2 -pi l.jpg +$bin/exiv2 -iX l.jpg +$bin/exiv2 -px l.jpg +$bin/exiv2 -PEkycv l.jpg +$bin/exiv2 -pi l.jpg # 6) Convert an Exif user comment to XMP echo echo Testcase 6 echo ========== \cp $IMG m.jpg -$exiv2 -M'set Exif.Photo.UserComment charset=Jis This is a JIS encoded Exif user comment. Or was it?' m.jpg -$exiv2 -PEkycv m.jpg +$bin/exiv2 -M'set Exif.Photo.UserComment charset=Jis This is a JIS encoded Exif user comment. Or was it?' m.jpg +$bin/exiv2 -PEkycv m.jpg rm -f m.xmp -$exiv2 -eX m.jpg -$exiv2 -px m.xmp -$exiv2 -PEkycv m.xmp -$exiv2 -v -pi m.xmp +$bin/exiv2 -eX m.jpg +$bin/exiv2 -px m.xmp +$bin/exiv2 -PEkycv m.xmp +$bin/exiv2 -v -pi m.xmp # 7) And back to Exif echo @@ -99,25 +103,25 @@ echo Testcase 7 echo ========== \cp $IMG n.jpg \cp m.xmp n.xmp -$exiv2 -iX n.jpg -$exiv2 -px n.jpg -$exiv2 -PEkycv n.jpg -$exiv2 -v -pi n.jpg +$bin/exiv2 -iX n.jpg +$bin/exiv2 -px n.jpg +$bin/exiv2 -PEkycv n.jpg +$bin/exiv2 -v -pi n.jpg # 8) Convert IPTC keywords to XMP echo echo Testcase 8 echo ========== \cp $IMG o.jpg -$exiv2 -M'add Iptc.Application2.Keywords Sex' o.jpg -$exiv2 -M'add Iptc.Application2.Keywords Drugs' o.jpg -$exiv2 -M"add Iptc.Application2.Keywords Rock'n'roll" o.jpg -$exiv2 -pi o.jpg +$bin/exiv2 -M'add Iptc.Application2.Keywords Sex' o.jpg +$bin/exiv2 -M'add Iptc.Application2.Keywords Drugs' o.jpg +$bin/exiv2 -M"add Iptc.Application2.Keywords Rock'n'roll" o.jpg +$bin/exiv2 -pi o.jpg rm -f o.xmp -$exiv2 -eX o.jpg -$exiv2 -px o.xmp -$exiv2 -v -PEkycv o.xmp -$exiv2 -pi o.xmp +$bin/exiv2 -eX o.jpg +$bin/exiv2 -px o.xmp +$bin/exiv2 -v -PEkycv o.xmp +$bin/exiv2 -pi o.xmp # 9) And back to IPTC echo @@ -125,23 +129,23 @@ echo Testcase 9 echo ========== \cp $IMG p.jpg \cp o.xmp p.xmp -$exiv2 -iX p.jpg -$exiv2 -px p.jpg -$exiv2 -v -PEkycv p.jpg -$exiv2 -pi p.jpg +$bin/exiv2 -iX p.jpg +$bin/exiv2 -px p.jpg +$bin/exiv2 -v -PEkycv p.jpg +$bin/exiv2 -pi p.jpg # 10) Convert an Exif tag to an XMP text value echo echo Testcase 10 echo =========== \cp $IMG q.jpg -$exiv2 -M'set Exif.Image.Software Exiv2' q.jpg -$exiv2 -PEkycv q.jpg +$bin/exiv2 -M'set Exif.Image.Software Exiv2' q.jpg +$bin/exiv2 -PEkycv q.jpg rm -f q.xmp -$exiv2 -eX q.jpg -$exiv2 -px q.xmp -$exiv2 -PEkycv q.xmp -$exiv2 -v -pi q.xmp +$bin/exiv2 -eX q.jpg +$bin/exiv2 -px q.xmp +$bin/exiv2 -PEkycv q.xmp +$bin/exiv2 -v -pi q.xmp # 11) And back to Exif echo @@ -149,23 +153,23 @@ echo Testcase 11 echo =========== \cp $IMG r.jpg \cp q.xmp r.xmp -$exiv2 -iX r.jpg -$exiv2 -px r.jpg -$exiv2 -PEkycv r.jpg -$exiv2 -v -pi r.jpg +$bin/exiv2 -iX r.jpg +$bin/exiv2 -px r.jpg +$bin/exiv2 -PEkycv r.jpg +$bin/exiv2 -v -pi r.jpg # 12) Convert an IPTC dataset to an XMP text value echo echo Testcase 12 echo =========== \cp $IMG s.jpg -$exiv2 -M'set Iptc.Application2.SubLocation Kuala Lumpur' s.jpg -$exiv2 -pi s.jpg +$bin/exiv2 -M'set Iptc.Application2.SubLocation Kuala Lumpur' s.jpg +$bin/exiv2 -pi s.jpg rm -f s.xmp -$exiv2 -eX s.jpg -$exiv2 -px s.xmp -$exiv2 -v -PEkycv s.xmp -$exiv2 -pi s.xmp +$bin/exiv2 -eX s.jpg +$bin/exiv2 -px s.xmp +$bin/exiv2 -v -PEkycv s.xmp +$bin/exiv2 -pi s.xmp # 13) And back to IPTC echo @@ -173,34 +177,34 @@ echo Testcase 13 echo =========== \cp $IMG t.jpg \cp s.xmp t.xmp -$exiv2 -iX t.jpg -$exiv2 -px t.jpg -$exiv2 -v -PEkycv t.jpg -$exiv2 -pi t.jpg +$bin/exiv2 -iX t.jpg +$bin/exiv2 -px t.jpg +$bin/exiv2 -v -PEkycv t.jpg +$bin/exiv2 -pi t.jpg # 14) Convert a few other tags of interest from Exif/IPTC to XMP echo echo Testcase 14 echo =========== \cp $IMG u.jpg -$exiv2 -M'set Exif.Photo.DateTimeOriginal 2003:12:14 12:01:44' u.jpg -$exiv2 -M'set Exif.Photo.SubSecTimeOriginal 999999999' u.jpg -$exiv2 -M'set Exif.Photo.ExifVersion 48 50 50 49' u.jpg -$exiv2 -M'set Exif.Photo.ComponentsConfiguration 1 2 3 0' u.jpg -$exiv2 -M'set Exif.Photo.Flash 73' u.jpg -$exiv2 -M'set Exif.GPSInfo.GPSLatitude 3/1 8/1 29734512/1000000' u.jpg -$exiv2 -M'set Exif.GPSInfo.GPSLatitudeRef N' u.jpg -$exiv2 -M'set Exif.GPSInfo.GPSVersionID 2 2 0 1' u.jpg -$exiv2 -M'set Exif.GPSInfo.GPSTimeStamp 1/1 2/1 999999999/1000000000' u.jpg -$exiv2 -M'set Iptc.Application2.DateCreated 2007-05-09' u.jpg - -$exiv2 -PEkycv u.jpg -$exiv2 -pi u.jpg +$bin/exiv2 -M'set Exif.Photo.DateTimeOriginal 2003:12:14 12:01:44' u.jpg +$bin/exiv2 -M'set Exif.Photo.SubSecTimeOriginal 999999999' u.jpg +$bin/exiv2 -M'set Exif.Photo.ExifVersion 48 50 50 49' u.jpg +$bin/exiv2 -M'set Exif.Photo.ComponentsConfiguration 1 2 3 0' u.jpg +$bin/exiv2 -M'set Exif.Photo.Flash 73' u.jpg +$bin/exiv2 -M'set Exif.GPSInfo.GPSLatitude 3/1 8/1 29734512/1000000' u.jpg +$bin/exiv2 -M'set Exif.GPSInfo.GPSLatitudeRef N' u.jpg +$bin/exiv2 -M'set Exif.GPSInfo.GPSVersionID 2 2 0 1' u.jpg +$bin/exiv2 -M'set Exif.GPSInfo.GPSTimeStamp 1/1 2/1 999999999/1000000000' u.jpg +$bin/exiv2 -M'set Iptc.Application2.DateCreated 2007-05-09' u.jpg + +$bin/exiv2 -PEkycv u.jpg +$bin/exiv2 -pi u.jpg rm -f u.xmp -$exiv2 -eX u.jpg -$exiv2 -px u.xmp -$exiv2 -PEkycv u.xmp -$exiv2 -pi u.xmp +$bin/exiv2 -eX u.jpg +$bin/exiv2 -px u.xmp +$bin/exiv2 -PEkycv u.xmp +$bin/exiv2 -pi u.xmp # 15) And back to Exif/IPTC echo @@ -208,11 +212,11 @@ echo Testcase 15 echo =========== \cp $IMG v.jpg \cp u.xmp v.xmp -$exiv2 -M'set Xmp.tiff.DateTime 2003-12-14T12:01:44Z' v.xmp -TZ=GMT-8 $exiv2 -iX v.jpg -$exiv2 -px v.jpg -$exiv2 -PEkycv v.jpg -$exiv2 -pi v.jpg +$bin/exiv2 -M'set Xmp.tiff.DateTime 2003-12-14T12:01:44Z' v.xmp +TZ=GMT-8 $bin/exiv2 -iX v.jpg +$bin/exiv2 -px v.jpg +$bin/exiv2 -PEkycv v.jpg +$bin/exiv2 -pi v.jpg ) > $results 2>&1 diff --git a/test/crw-test.sh b/test/crw-test.sh index ebebabc5..aae443e0 100755 --- a/test/crw-test.sh +++ b/test/crw-test.sh @@ -16,8 +16,13 @@ fi # ---------------------------------------------------------------------- # Main routine ( -binpath="$VALGRIND ../../src" -exiv2="$VALGRIND exiv2" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cmdfile=cmdfile crwfile=exiv2-canon-powershot-s40.crw @@ -37,12 +42,12 @@ set Exif.Photo.DateTimeOriginal 2007:11:11 09:10:11 EOF cp -f ../data/$crwfile . -$exiv2 -v -pt $crwfile +$bin/exiv2 -v -pt $crwfile -$exiv2 -v -m $cmdfile $crwfile -$binpath/crwparse $crwfile +$bin/exiv2 -v -m $cmdfile $crwfile +$bin/crwparse $crwfile -$exiv2 -v -pt $crwfile +$bin/exiv2 -v -pt $crwfile # ---------------------------------------------------------------------- # Testcases: Delete tags @@ -52,12 +57,12 @@ del Exif.Canon.OwnerName EOF cp -f ../data/$crwfile . -$exiv2 -v -pt $crwfile +$bin/exiv2 -v -pt $crwfile -$exiv2 -v -m $cmdfile $crwfile -$binpath/crwparse $crwfile +$bin/exiv2 -v -m $cmdfile $crwfile +$bin/crwparse $crwfile -$exiv2 -v -pt $crwfile +$bin/exiv2 -v -pt $crwfile ) > $results 2>&1 diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index a6ada293..5f478f40 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -2,7 +2,6 @@ Exiv2 test directory ----------------------------------------------------- tmp/ Exiv2 version ------------------------------------------------------------ -/usr/local/bin/exiv2 exiv2 0.21.1 (__ bit build) Copyright (C) 2004-2011 Andreas Huggel. diff --git a/test/eps-test.sh b/test/eps-test.sh index 8c657e60..20458f43 100755 --- a/test/eps-test.sh +++ b/test/eps-test.sh @@ -5,9 +5,15 @@ export LC_ALL=C cd tmp/ -exiv2="$VALGRIND ../../src/exiv2" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi -exiv2version="`$exiv2 -V | sed -n '1 s,^exiv2 \([^ ]*\).*,\1,p'`" +exiv2version="`$bin/exiv2 -V | sed -n '1 s,^exiv2 \([^ ]*\).*,\1,p'`" if [ -z "$exiv2version" ]; then echo "Error: Unable to determine Exiv2 version" exit 1 @@ -38,7 +44,7 @@ done echo echo "Command: exiv2 -u -pa $image.eps" - $exiv2 -u -pa "$image.eps" + $bin/exiv2 -u -pa "$image.eps" exitcode="$?" echo "Exit code: $exitcode" @@ -48,12 +54,12 @@ done echo echo "Command: exiv2 -pp $image.eps" - $exiv2 -pp "$image.eps" + $bin/exiv2 -pp "$image.eps" echo "Exit code: $?" echo echo "Command: exiv2 -f -eX $image.eps" - $exiv2 -f -eX "$image.eps" + $bin/exiv2 -f -eX "$image.eps" echo "Exit code: $?" diff -q "../data/eps/$image.xmp" "$image.xmp" @@ -65,7 +71,7 @@ done echo echo "Command: exiv2 -ix $image.eps" - $exiv2 -ix "$image.eps" + $bin/exiv2 -ix "$image.eps" exitcode="$?" echo "Exit code: $exitcode" @@ -79,7 +85,7 @@ done echo echo "Command: (2) exiv2 -ix $image.eps" - $exiv2 -ix "$image.eps" + $bin/exiv2 -ix "$image.eps" echo "Exit code: $?" diff -q "$image.eps.newxmp" "$image.eps" @@ -90,7 +96,7 @@ done echo echo "Command: exiv2 -f -ex $image.eps" - $exiv2 -f -ex "$image.eps" + $bin/exiv2 -f -ex "$image.eps" echo "Exit code: $?" diff -q "../data/eps/eps-test-newxmp.exv" "$image.exv" diff --git a/test/exifdata-test.sh b/test/exifdata-test.sh index c8e549f9..1b52fe04 100755 --- a/test/exifdata-test.sh +++ b/test/exifdata-test.sh @@ -10,14 +10,20 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cp -f ./data/exiv2-gc.jpg ./tmp cp -f ./data/exiv2-canon-powershot-s40.jpg ./tmp cp -f ./data/exiv2-nikon-d70.jpg ./tmp cd ./tmp -$binpath/exifdata-test exiv2-gc.jpg -$binpath/exifdata-test exiv2-canon-powershot-s40.jpg -$binpath/exifdata-test exiv2-nikon-d70.jpg +$samples/exifdata-test exiv2-gc.jpg +$samples/exifdata-test exiv2-canon-powershot-s40.jpg +$samples/exifdata-test exiv2-nikon-d70.jpg ) > $results diff -q $diffargs $results $good diff --git a/test/exiv2-test.sh b/test/exiv2-test.sh index 74f6893a..55cadb81 100755 --- a/test/exiv2-test.sh +++ b/test/exiv2-test.sh @@ -1,7 +1,13 @@ #! /bin/sh # Test driver for exiv2 utility tests export LC_ALL=C -exiv2="$VALGRIND exiv2 -u" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi results="./tmp/exiv2-test.out" good="./data/exiv2-test.out" tmpfile=tmp/ttt @@ -77,44 +83,43 @@ cd tmp/ >/dev/null || exit 1; echo tmp/ echo echo "Exiv2 version ------------------------------------------------------------" -which exiv2 || exit 2; -$exiv2 -V | sed '1 s, (.. bit build)$, (__ bit build),' +$bin/exiv2 -u -V | sed '1 s, (.. bit build)$, (__ bit build),' echo echo "Exiv2 help ---------------------------------------------------------------" -$exiv2 -h +$bin/exiv2 -u -h echo echo "Adjust -------------------------------------------------------------------" -$exiv2 -v -a-12:01:01 adjust $images +$bin/exiv2 -u -v -a-12:01:01 adjust $images echo echo "Rename -------------------------------------------------------------------" -$exiv2 -vf rename $images +$bin/exiv2 -u -vf rename $images echo echo "Print --------------------------------------------------------------------" -$exiv2 -v print $image2 -$exiv2 -v -b -pt print $image2 -$exiv2 -v -b -pt print $image2 > iii +$bin/exiv2 -u -v print $image2 +$bin/exiv2 -u -v -b -pt print $image2 +$bin/exiv2 -u -v -b -pt print $image2 > iii echo echo "Extract Exif data --------------------------------------------------------" -$exiv2 -vf extract $image2 +$bin/exiv2 -u -vf extract $image2 echo echo "Extract Thumbnail --------------------------------------------------------" -$exiv2 -vf -et extract $image2 -$exiv2 -v -b -pt print $image3 > jjj +$bin/exiv2 -u -vf -et extract $image2 +$bin/exiv2 -u -v -b -pt print $image3 > jjj echo echo "Compare image data and extracted data ------------------------------------" diff iii jjj echo echo "Delete Thumbnail ---------------------------------------------------------" -$exiv2 -v -dt delete $image2 -$exiv2 -vf -et extract $image2 +$bin/exiv2 -u -v -dt delete $image2 +$bin/exiv2 -u -vf -et extract $image2 echo echo "Delete Exif data ---------------------------------------------------------" -$exiv2 -v delete $image2 -$exiv2 -v print $image2 +$bin/exiv2 -u -v delete $image2 +$bin/exiv2 -u -v print $image2 echo echo "Insert Exif data ---------------------------------------------------------" -$exiv2 -v insert $image2 -$exiv2 -v -b -pt print $image3 > kkk +$bin/exiv2 -u -v insert $image2 +$bin/exiv2 -u -v -b -pt print $image3 > kkk echo echo "Compare original and inserted image data ---------------------------------" diff iii kkk diff --git a/test/imagetest.sh b/test/imagetest.sh index c5495c2f..cc2df2f9 100755 --- a/test/imagetest.sh +++ b/test/imagetest.sh @@ -11,7 +11,7 @@ eraseTest() cp $datapath/$src $test #run tests - $binpath/metacopy $test $test + $bin/metacopy $test $test #check results diffCheck $test $good @@ -30,7 +30,7 @@ copyTest() cp $datapath/$dst $test #run tests - $binpath/metacopy -a $datapath/$src $test + $bin/metacopy -a $datapath/$src $test #check results diffCheck $test $good @@ -49,7 +49,7 @@ iptcTest() cp $datapath/$dst $test #run tests - $binpath/metacopy -ip $datapath/$src $test + $bin/metacopy -ip $datapath/$src $test #check results diffCheck $test $good @@ -75,9 +75,14 @@ diffCheck() # ********************************************************************** # main -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi + datapath="../data" test_files="table.jpg smiley1.jpg smiley2.jpg" diff --git a/test/iotest.sh b/test/iotest.sh index 052eff9a..172b1159 100755 --- a/test/iotest.sh +++ b/test/iotest.sh @@ -8,7 +8,7 @@ ioTest() out2=${1}.2 #run tests - $binpath/iotest $src $out1 $out2 + $samples/iotest $src $out1 $out2 if [ $? -ne 0 ]; then errors=`expr $errors + 1` return @@ -38,7 +38,14 @@ diffCheck() # ********************************************************************** # main -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi + datapath="../data" test_files="table.jpg smiley2.jpg ext.dat" diff --git a/test/iptctest.sh b/test/iptctest.sh index 812e45a8..0b1debc0 100755 --- a/test/iptctest.sh +++ b/test/iptctest.sh @@ -8,7 +8,7 @@ printTest() good=$datapath/${src}.ipgd #run tests - $binpath/iptcprint $datapath/$src > $test + $samples/iptcprint $datapath/$src > $test #check results diffCheck $test $good @@ -26,7 +26,7 @@ removeTest() cp $datapath/$src $tmp #run tests - $binpath/iptctest $tmp <<-eoc + $samples/iptctest $tmp <<-eoc r Iptc.Application2.Byline r Iptc.Application2.Caption r Iptc.Application2.Keywords @@ -34,7 +34,7 @@ removeTest() r Iptc.Application2.Keywords r Iptc.Application2.CountryName eoc - $binpath/iptcprint $tmp > $test + $samples/iptcprint $tmp > $test #check results diffCheck $test $good @@ -53,7 +53,7 @@ addModTest() cp $datapath/$src $tmp #run tests - $binpath/iptctest $tmp <<-eoc + $samples/iptctest $tmp <<-eoc a Iptc.Application2.Headline The headline I am a Iptc.Application2.Keywords Yet another keyword m Iptc.Application2.DateCreated 2004-8-3 @@ -63,7 +63,7 @@ addModTest() a Iptc.Envelope.TimeSent 14:41:0-05:00 a Iptc.Application2.RasterizedCaption 230 42 34 2 90 84 23 146 eoc - $binpath/iptcprint $tmp > $test + $samples/iptcprint $tmp > $test #check results diffCheck $test $good @@ -82,8 +82,8 @@ extendedTest() cp $datapath/$src $tmp #run tests - $binpath/iptctest $tmp < $datapath/ext.dat - $binpath/iptcprint $tmp > $test + $samples/iptctest $tmp < $datapath/ext.dat + $samples/iptcprint $tmp > $test #check results diffCheck $test $good @@ -110,7 +110,13 @@ diffCheck() # ********************************************************************** # main -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi datapath="../data" diffargs="--strip-trailing-cr" tmpfile=tmp/ttt diff --git a/test/modify-test.sh b/test/modify-test.sh index b474dd6c..ad2f7d84 100755 --- a/test/modify-test.sh +++ b/test/modify-test.sh @@ -1,6 +1,13 @@ #! /bin/sh # Test driver for write unit tests to build Exif metadata from scratch export LC_ALL=C +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi results="./tmp/modify-test.out" good="./data/modify-test.out" diffargs="--strip-trailing-cr" @@ -14,10 +21,10 @@ fi cp -f ./data/exiv2-empty.jpg ./tmp cp -f ./data/exiv2-gc.jpg ./tmp cd ./tmp -$VALGRIND exiv2 -v -m ../data/modifycmd1.txt exiv2-empty.jpg -$VALGRIND exiv2 -v -m ../data/modifycmd2.txt exiv2-gc.jpg -$VALGRIND exiv2 -v -pi exiv2-empty.jpg -$VALGRIND exiv2 -v -pt exiv2-empty.jpg exiv2-gc.jpg +$bin/exiv2 -v -m ../data/modifycmd1.txt exiv2-empty.jpg +$bin/exiv2 -v -m ../data/modifycmd2.txt exiv2-gc.jpg +$bin/exiv2 -v -pi exiv2-empty.jpg +$bin/exiv2 -v -pt exiv2-empty.jpg exiv2-gc.jpg ) > $results diff --git a/test/path-test.sh b/test/path-test.sh index 7e671c3d..dd4b2878 100755 --- a/test/path-test.sh +++ b/test/path-test.sh @@ -1,7 +1,12 @@ #! /bin/sh # Mini test-driver for path utility functions -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cd ./tmp -$binpath/path-test ../data/path-test.txt +$bin/path-test ../data/path-test.txt diff --git a/test/stringto-test.sh b/test/stringto-test.sh index dabe4b06..6e68e443 100755 --- a/test/stringto-test.sh +++ b/test/stringto-test.sh @@ -10,9 +10,15 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cd ./tmp -$binpath/stringto-test +$samples/stringto-test ) > $results diff -q $diffargs $results $good diff --git a/test/tiff-test.sh b/test/tiff-test.sh index 6f55c579..c996cfbf 100644 --- a/test/tiff-test.sh +++ b/test/tiff-test.sh @@ -16,8 +16,13 @@ good="./data/tiff-test.out" # ---------------------------------------------------------------------- # Main routine ( -binpath="$VALGRIND ../../samples" -exiv2="$VALGRIND ../../src/exiv2" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cd ./tmp # ---------------------------------------------------------------------- @@ -25,7 +30,7 @@ cd ./tmp testfile=mini9.tif cp -f ../data/$testfile . exifprobe $testfile -$binpath/tiff-test $testfile +$samples/tiff-test $testfile exifprobe $testfile ) > $results diff --git a/test/write-test.sh b/test/write-test.sh index 2818e7ac..a50a349a 100755 --- a/test/write-test.sh +++ b/test/write-test.sh @@ -22,16 +22,22 @@ runTestCase() rm -f $datapath/iii $datapath/ttt; echo "------------------------------------------------------------" - $binpath/exifprint $rtc_infile > $datapath/iii; + $samples/exifprint $rtc_infile > $datapath/iii; cp $rtc_infile $rtc_outfile; - $binpath/write-test $rtc_infile $rtc_number > $datapath/ttt; + $samples/write-test $rtc_infile $rtc_number > $datapath/ttt; diff -a $datapath/iii $datapath/ttt } # ********************************************************************** # main -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi datapath="." diffargs="--strip-trailing-cr" tmpfile=tmp/ttt diff --git a/test/write2-test.sh b/test/write2-test.sh index fb36e8d9..f2e738ac 100755 --- a/test/write2-test.sh +++ b/test/write2-test.sh @@ -10,10 +10,16 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -binpath="$VALGRIND ../../samples" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi cp -f ./data/exiv2-empty.jpg ./tmp cd ./tmp -$binpath/write2-test exiv2-empty.jpg +$samples/write2-test exiv2-empty.jpg ) > $results diff -q $diffargs $results $good diff --git a/test/xmpparser-test.sh b/test/xmpparser-test.sh index c5a1bc9f..db76cf67 100755 --- a/test/xmpparser-test.sh +++ b/test/xmpparser-test.sh @@ -1,59 +1,63 @@ #! /bin/sh # XMP parser test driver +# ---------------------------------------------------------------------- +# Setup +export LC_ALL=C +results="./xmpparser-test.out" +good="../data/xmpparser-test.out" +if [ -z "$EXIV2_BINDIR" ] ; then + bin="$VALGRIND ../../src" + samples="$VALGRIND ../../samples" +else + bin="$VALGRIND $EXIV2_BINDIR" + samples="$VALGRIND $EXIV2_BINDIR" +fi +cd ./tmp + # ---------------------------------------------------------------------- # Check if xmpparser-test exists -if [ ! -e ../samples/xmpparser-test ] ; then +if [ ! -e ../../samples/xmpparser-test -a ! -e "$EXIV2_BINDIR/xmpparser-test" ] ; then echo "xmpparser-test not found. Assuming XMP support is not enabled." exit 0 fi -# ---------------------------------------------------------------------- -# Setup -export LC_ALL=C -results="./tmp/xmpparser-test.out" -good="./data/xmpparser-test.out" - # ---------------------------------------------------------------------- # Main routine ( -binpath="$VALGRIND ../../samples" -exiv2="$VALGRIND exiv2" -cd ./tmp - # ---------------------------------------------------------------------- # BlueSquare testfile=BlueSquare.xmp cp -f ../data/$testfile . -$binpath/xmpparser-test $testfile +$samples/xmpparser-test $testfile diff $testfile ${testfile}-new # ---------------------------------------------------------------------- # StaffPhotographer-Example testfile=StaffPhotographer-Example.xmp cp -f ../data/$testfile . -$binpath/xmpparser-test $testfile +$samples/xmpparser-test $testfile diff $testfile ${testfile}-new # ---------------------------------------------------------------------- # xmpsdk testfile=xmpsdk.xmp cp -f ../data/$testfile . -$binpath/xmpparser-test $testfile +$samples/xmpparser-test $testfile diff $testfile ${testfile}-new -$binpath/xmpparse ${testfile} > t1 2>&1 -$binpath/xmpparse ${testfile}-new > t2 2>&1 +$samples/xmpparse ${testfile} > t1 2>&1 +$samples/xmpparse ${testfile}-new > t2 2>&1 diff t1 t2 # ---------------------------------------------------------------------- # xmpsample -$binpath/xmpsample +$samples/xmpsample # ---------------------------------------------------------------------- # XMP sample commands cp -f ../data/exiv2-empty.jpg . -$exiv2 -v -m ../data/cmdxmp.txt exiv2-empty.jpg -$exiv2 -v -px exiv2-empty.jpg +$bin/exiv2 -v -m ../data/cmdxmp.txt exiv2-empty.jpg +$bin/exiv2 -v -px exiv2-empty.jpg ) > $results 2>&1