[PATCH v2 3/7] test: Use cmp to catch byte-by-byte identical files

"Bryce W. Harrington" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <5A5FB412583EA944A1D0228D52A9C57263A53A@sisaex02sj>
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 <[email protected]>
---
 test/check_refs.sh |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/test/check_refs.sh b/test/check_refs.sh
index 649d509..a9dfe17 100755
--- a/test/check_refs.sh
+++ b/test/check_refs.sh
@@ -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
-- 
1.7.9.5

--
Bryce Harrington
Senior Open Source Developer  -  [email protected]
Open Source Group             -  Samsung Research America
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.