[cairo] [PATCH v2 4/7] test: Make check-ref-dups utilize perceptualdiff for comparisons

Bryce W. Harrington b.harrington at samsung.com
Wed Jul 3 15:35:47 PDT 2013


The current sha1sum-based file checker does a blanket comparison of all
files with each other, which is fast but not directly helpful since it
doesn't distinguish between sibling files (which are allowable to be
duplicates).  Also, it ignores files that may have byte differences
(such as PNG header differences) but are otherwise pixel-identical.

This patch replaces the sha1sum-based checker with one that accounts for
the default fallback path and uses perceptualdiff to compare files that
are bytewise different and verify whether they actually are different.

The intention is that the output of this command can be directly used to
remove redundant files, e.g.:

  cd test
  make check-ref-dups | cut -d' ' -f2 | \
      while read f; do git rm "reference/$f"; done

This should have no impact on make check's results (modulo any tests
that behave erratically), and will help trim down the size of the
tarball.

Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
 test/Makefile.am |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index a097409..94a7f53 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -290,6 +290,9 @@ $(top_builddir)/src/libcairo.la:
 $(top_builddir)/test/pdiff/libpdiff.la:
 	cd $(top_builddir)/test/pdiff && $(MAKE) $(AM_MAKEFLAGS) libpdiff.la
 
+$(top_builddir)/test/pdiff/perceptualdiff:
+	cd $(top_builddir)/test/pdiff && $(MAKE) $(AM_MAKEFLAGS) perceptualdiff
+
 $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la: $(top_builddir)/src/libcairo.la
 	cd $(top_builddir)/util/cairo-script && $(MAKE) $(AM_MAKEFLAGS) libcairo-script-interpreter.la
 
@@ -446,10 +449,8 @@ $(NOLOG_TESTS_LOG):
 	@echo dummy > $@
 
 # Identify identical reference images
-check-ref-dups:
-	@LANG=C; \
-	( cd "$(srcdir)/reference" && sha1sum *.ref.png | sort ) > ref.hash; \
-	join ref.hash ref.hash | grep -v -E '( .*.ref.png).*\1' | cut -d' ' -f 1-2 | sort -u
+check-ref-dups: check_refs.sh $(top_builddir)/test/pdiff/perceptualdiff
+	cd $(srcdir) && sh ./check_refs.sh
 
 results.tar:
 	@tar cf $@ index.html testtable.js *.log output/*.log; \
-- 
1.7.9.5

--
Bryce Harrington
Senior Open Source Developer  -  b.harrington at samsung.com
Open Source Group             -  Samsung Research America



More information about the cairo mailing list