From: Dan F. <dfa...@us...> - 2009-12-17 07:10:18
|
Update of /cvsroot/libexif/libexif-testsuite/tests In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20063 Modified Files: Makefile.am check-no-unknown-tags.sh check-readwrite-identity.sh check-vars.sh.in Added Files: image-info.sh Log Message: Moved functions that determine image characteristics into image-info.sh. Added functions to return whether images have unsorted or unknown tags so the tests can work around the problems. Index: check-vars.sh.in =================================================================== RCS file: /cvsroot/libexif/libexif-testsuite/tests/check-vars.sh.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- check-vars.sh.in 13 Jan 2009 22:31:46 -0000 1.2 +++ check-vars.sh.in 17 Dec 2009 07:09:58 -0000 1.3 @@ -12,13 +12,5 @@ DIFFEXE=@DIFF@ # space-separated list of all JPEG images to test ALLFILES="$TOPSRCDIR/src/pel-images/*.jpg $SRCDIR/images/*.jpg" -# Function that returns true when the given file contains no EXIF tags -noexiftags () { - # Test images without EXIF tags - case "$1" in - *-thumb* | *no-exif* | *canon-powershot-a400-001.jpg) - return 0 # No EXIF tags in this image - ;; - esac - return 1 # normal image with EXIF tags -} +# Load functions that determine characteristics of the $ALLFILES test images +. image-info.sh --- NEW FILE: image-info.sh --- # Test functions for use within libexif-testsuite tests. # These functions return characteristics of the various images that form # a part of the test suite. Each function is called with the file name of # the image as the only argument and returns a status value of 0 for true or # 1 for false. # Function that returns true when the given file contains no EXIF tags noexiftags () { # This line could almost replace this function except that # it fails with a few images, and it's a lot slower: #file "$1" | grep -v -q "EXIF standard" case "$1" in *-thumb* | *no-exif* | *canon-powershot-a400-001.jpg) return 0 # No EXIF tags in this image ;; esac return 1 # normal image with EXIF tags } # Function that returns true when the given file contains tags that are # not properly sorted (i.e. the input file is corrupt and not to spec). unsortedtags () { case "$1" in *Kodak_C310.jpg) return 0 # Input file has unsorted tags ;; esac return 1 # normal image } # Function that returns true when the given file contains tags that are # not recognized by libexif (i.e. the input file is corrupt and not to spec). unknowntags () { case "$1" in *Panasonic_DMC-G1.jpg) return 0 # Input file has unknown tags ;; esac return 1 # normal image } Index: check-readwrite-identity.sh =================================================================== RCS file: /cvsroot/libexif/libexif-testsuite/tests/check-readwrite-identity.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- check-readwrite-identity.sh 13 Nov 2009 07:54:13 -0000 1.3 +++ check-readwrite-identity.sh 17 Dec 2009 07:09:58 -0000 1.4 @@ -72,10 +72,15 @@ do check_result $tmpfile2 # Compare the tag output of the original and copied files. - # A difference here could simply be due to the sort order, which - # could be due to the original EXIF file being corrupt. canonicalize "$tmpfile" canonicalize "$tmpfile2" + if unsortedtags "${img}"; then + # If input file is not to spec and its tags are not sorted, + # sort the before and after files so they will compare equal + echo Sorting tags on out-of-spec image + sort -o "$tmpfile" "$tmpfile" + sort -o "$tmpfile2" "$tmpfile2" + fi echo -n "Comparing before and after..." "$DIFFEXE" "$tmpfile" "$tmpfile2" check_result Index: check-no-unknown-tags.sh =================================================================== RCS file: /cvsroot/libexif/libexif-testsuite/tests/check-no-unknown-tags.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- check-no-unknown-tags.sh 13 Jan 2009 22:31:46 -0000 1.2 +++ check-no-unknown-tags.sh 17 Dec 2009 07:09:58 -0000 1.3 @@ -1,5 +1,6 @@ #!/bin/sh # Run all test images through exif and ensure that all the tags are known. +# This is as much a test of the images as of exif itself. . check-vars.sh @@ -36,6 +37,11 @@ do continue # skip image fi + if unknowntags "$img" ; then + echo "Skipping $img due to known, unknown tags" + continue # skip image + fi + total_img=$(expr $total_img + 1) echo -n "#${total_img} " Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif-testsuite/tests/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -p -d -r1.29 -r1.30 --- Makefile.am 24 Nov 2009 05:31:31 -0000 1.29 +++ Makefile.am 17 Dec 2009 07:09:58 -0000 1.30 @@ -11,6 +11,7 @@ SUBDIRS = images # check-vars.sh.in is automatically included EXTRA_DIST = \ + image-info.sh \ check-exif-executable.sh \ check-general-images.sh \ check-readwrite-identity.sh \ |