test: Use cmp to catch byte-by-byte identical files

cmp runs faster than perceptualdiff, and catches files that are exact
copies of the reference image.  We still use perceptualdiff for catching
files that aren't bytewise identical, but are still identical at the
pixel level.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
This commit is contained in:
Bryce W. Harrington 2013-07-03 22:35:08 +00:00 committed by Chris Wilson
parent b0be0d8d42
commit 8d3c518e9d

View file

@ -47,14 +47,18 @@ for file in *.ref.png; do
fi
if [ -e $ref ]; then
# Run perceptualdiff with minimum threshold
pdiff_output=$($pdiff $ref $file -threshold 1)
result=${pdiff_output%:*}
notes=$(echo "${pdiff_output#*: }" | tail -n 1)
if [ "$result" = "PASS" ] && [ "$notes" = "Images are binary identical" ]; then
printf "redundant: %s is binary identical to %s\n" $file $ref
notes=""
fi
if cmp --silent "$ref" "$file" ; then
printf "redundant: %s and %s are byte-by-byte identical files\n" $file $ref
else
# Run perceptualdiff with minimum threshold
pdiff_output=$($pdiff $ref $file -threshold 1)
result=${pdiff_output%:*}
notes=$(echo "${pdiff_output#*: }" | tail -n 1)
if [ "$result" = "PASS" ] && [ "$notes" = "Images are binary identical" ]; then
printf "redundant: %s and %s are pixel equivalent images\n" $file $ref
notes=""
fi
fi
fi
done