[gegl] tests: Rewrite compositions tests framework
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] tests: Rewrite compositions tests framework
- Date: Sat, 14 Aug 2010 07:57:46 +0000 (UTC)
commit 5156d46e4e264ff7578817cf29fa1f256e1361db
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Aug 14 00:34:03 2010 +0200
tests: Rewrite compositions tests framework
Rewrite composition tests, generate one script for each composition to
test and use the automake TESTS feature to test them all. The rewrite
has these benefits:
* Process a single test fully at once. Previously it did all
renderings first, then compared with all references
* We don't need any hackish scripts with time stamps and diffs of
directory listings to see if we succeeded, Automake does nice
reporting of test results for us
* We don't need to track complex dependencies, instead, make check
will always run the tests. Makes it easier re-run tests repeatedly
for debugging for example
* We can include certain tests conditionally, for example to exclude
tests when configure time dependencies have not been met
tests/compositions/.gitignore | 5 +-
tests/compositions/Makefile.am | 84 ++++++++++++++++++---------------
tests/compositions/verify-results.sh | 18 -------
3 files changed, 49 insertions(+), 58 deletions(-)
---
diff --git a/tests/compositions/.gitignore b/tests/compositions/.gitignore
index de213e5..38c202c 100644
--- a/tests/compositions/.gitignore
+++ b/tests/compositions/.gitignore
@@ -1,6 +1,7 @@
*~
/output
+/run-*.xml
Makefile
Makefile.in
-images.stamp
-tests-report
+
+
diff --git a/tests/compositions/Makefile.am b/tests/compositions/Makefile.am
index 5805300..825a083 100644
--- a/tests/compositions/Makefile.am
+++ b/tests/compositions/Makefile.am
@@ -3,14 +3,14 @@
# * Each test comes with one <name>.xml GEGL XML and one reference
# output file in 'reference' called <name>.<ext>, where <ext> is a
# supported output file type.
-# * The test is run by putting the XML into a file in 'output', named
-# <name>.<ext> and then compared with the file in 'reference'. If
-# these files are equal, the test is a 'pass'.
+# * The test is run by processing the GEGL XML into an output file in
+# 'output', named <name>.<ext>, and then compared with the file in
+# 'reference'. If these files are equal, the test is a 'pass'.
SUBDIRS=data
-EXTRA_DIST=$(wildcard *.xml) $(wildcard reference/*) verify-results.sh
+EXTRA_DIST=$(wildcard *.xml) $(wildcard reference/*)
# Env vars to make binaries use builddir stuff
builddir_gegl_env = GEGL_SWAP=RAM GEGL_PATH=$(top_builddir)/operations
@@ -23,40 +23,48 @@ img_cmp_bin = $(top_builddir)/tools/img_cmp$(EXEEXT)
builddir_gegl = $(builddir_gegl_env) $(gegl_bin)
builddir_img_cmp = $(builddir_gegl_env) $(img_cmp_bin)
+# These strings must not be inside XML file names; we use $(subst ...)
+testprefix = run-
+testsuffix = .sh
-# For simplicity, use the same time stamp for output of all
-# compositions. Use the same output file as in the reference dir
-images.stamp: $(wildcard $(srcdir)/*.xml) \
- $(wildcard $(top_builddir)/operations/.libs/*$(SHREXT)) \
- $(wildcard $(top_builddir)/operations/*/.libs/*$(SHREXT)) \
- $(wildcard $(top_builddir)/operations/*/*/.libs/*$(SHREXT)) \
- $(top_builddir)/gegl/libgegl-$(GEGL_API_VERSION).la \
- $(gegl_bin)
- @echo "--[doing XML composition test renderings]--"
- @mkdir -p ./output
- @for XML in $(srcdir)/*.xml; do \
- echo $$XML; \
- export BASE=`echo $$XML | sed s?$(srcdir)/?? | sed s/\.xml//`;\
- $(builddir_gegl) $$XML -o output/`basename $(srcdir)/reference/$$BASE.*`; \
- done
- @touch images.stamp
-
-# Read by verify-results.sh
-TESTS_ENVIRONMENT = VERIFY_RESULTS_REFERENCE=$(srcdir)/reference
-
-TESTS = verify-results.sh
-verify-results.sh: tests-report
-
-tests-report: images.stamp \
- $(top_srcdir)/tools/img_cmp \
- $(srcdir)/reference/*
- @echo "--[Verifying test renderings against references]--"
- @echo "" > tests-report ;
- @for XML in $(srcdir)/*.xml; do\
- echo $$XML; \
- export BASE=`echo $$XML | sed s?$(srcdir)/?? | sed s/\.xml//`;\
- $(builddir_img_cmp) $(srcdir)/reference/$$BASE.* output/$$BASE.* >> tests-report 2>&1; true ;\
- done;
+# List of tests. The .sh suffix allows us to use $(wildcard *.xml) in
+# EXTRA_DISTS
+TESTS = \
+ run-clones.xml.sh \
+ run-composite-transform.xml.sh \
+ run-downsharptest-broken.xml.sh \
+ run-downsizetest-broken.xml.sh \
+ run-downsmoothtest-broken.xml.sh \
+ run-fattal02.xml.sh \
+ run-hdr-color.xml.sh \
+ run-jp2-load.xml.sh \
+ run-mantiuk06.xml.sh \
+ run-reflect.xml.sh \
+ run-reflect2.xml.sh \
+ run-reinhard05.xml.sh \
+ run-rgb-params.xml.sh \
+ run-rgbe-load.xml.sh \
+ run-rgbe-save.xml.sh \
+ run-rotate.xml.sh \
+ run-simple-scale.xml.sh \
+ run-transform.xml.sh \
+ run-upsharptest.xml.sh \
+ run-upsizetest.xml.sh \
+ run-upsmoothtest.xml.sh
+
+# Create a separate executable script for each composition test to run
+test_to_xml = $(abs_srcdir)/$(subst $(testsuffix),,$(subst $(testprefix),,$(1)))
+test_to_ref = $(wildcard $(abs_srcdir)/reference/$(basename $(notdir $(call test_to_xml,$(1)))).*)
+test_to_out = $(abs_builddir)/output/$(notdir $(call test_to_ref,$(1)))
+$(testprefix)%.xml.sh: Makefile.am
+ @xml_file=$(call test_to_xml,$@) ;\
+ ref_img=$(call test_to_ref,$@) ;\
+ out_img=$(call test_to_out,$@) ;\
+ echo "#!/bin/sh" > $@ ;\
+ echo "mkdir -p $(abs_builddir)/output" >> $@ ;\
+ echo "$(builddir_gegl) $$xml_file -o $$out_img" >> $@ ;\
+ echo "$(builddir_img_cmp) $$ref_img $$out_img &> /dev/null" >> $@ ;\
+ chmod +x $@
clean-local:
- rm -f images.stamp output/* *.txt tests-report
+ rm -f $(testprefix)*.xml$(testsuffix) output/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]