2 # Compares the parsed EXIF data extracted from test images with the parsed EXIF
3 # data in the original images. This tests that the tag parsing and writing
4 # round-trip produces an EXIF structure with the same meaning as the original.
6 TMPORIGINAL="$(mktemp)"
7 TMPEXTRACTED="$(mktemp)"
9 trap 'rm -f "${TMPORIGINAL}" "${TMPEXTRACTED}" "${TMPDATA}"' 0
11 # Remove the file name, which is a harmless difference between the two outputs.
12 # Also delete the size of the MakerNote. Since the MakerNote is parsed
13 # internally and rewritten, it can sometimes have slightly different padding
14 # and therefore slightly different size, which is a semantically meaningless
16 # FIXME: Not all MakerNote differences are harmless. For example,
17 # olympus_makernote_variant_4.jpg has a huge size difference, probably because
18 # of a parsing bug in libexif. This should be investigated. Ideally, this would
19 # ignore small differences in size but trigger on larger differences.
20 parse_canonicalize () {
23 -e '/MakerNote (Undefined)$/{N;N;d}'
26 # Ensure that names are untranslated
30 export LANG LANGUAGE LC_ALL
31 for fn in "${srcdir}"/testdata/*.jpg ; do
32 ./test-parse "${fn}" | parse_canonicalize > "${TMPORIGINAL}"
33 ./test-extract -o "${TMPDATA}" "${fn}"
34 ./test-parse "${TMPDATA}" | parse_canonicalize > "${TMPEXTRACTED}"
35 if ! diff "${TMPORIGINAL}" "${TMPEXTRACTED}"; then
36 echo Error parsing "$fn"