gegl r2976 - in trunk: . tests tests/buffer



Author: martinn
Date: Sat Mar 21 11:26:11 2009
New Revision: 2976
URL: http://svn.gnome.org/viewvc/gegl?rev=2976&view=rev

Log:
Port buffer tests to automake

Port buffer tests to automake which has a couple of benefits. First of
all they are run and results reported during a normal make check, and
second of all the tests are run against the build and not against a
possibly non-existant installation based on hardcoded prefixes.

Added:
   trunk/tests/buffer/.gitignore
   trunk/tests/buffer/Makefile.am
   trunk/tests/buffer/buffer-tests-results.sh   (contents, props changed)
Removed:
   trunk/tests/buffer/Makefile
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/tests/Makefile.am

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Mar 21 11:26:11 2009
@@ -988,6 +988,7 @@
 examples/Makefile
 examples/data/Makefile
 tests/Makefile
+tests/buffer/Makefile
 gegl.pc
 gegl-uninstalled.pc
 ])

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Sat Mar 21 11:26:11 2009
@@ -1,3 +1,5 @@
+SUBDIRS = buffer
+
 # Make the tests run against the build and not the installation
 TESTS_ENVIRONMENT = \
 	GEGL_PATH=$(top_builddir)/operations/common:$(top_builddir)/operations/core

Added: trunk/tests/buffer/.gitignore
==============================================================================
--- (empty file)
+++ trunk/tests/buffer/.gitignore	Sat Mar 21 11:26:11 2009
@@ -0,0 +1,7 @@
+/.deps
+/Makefile.in
+/Makefile
+/buffer-test
+/buffer-tests-report
+/buffer-tests.inc
+/output

Added: trunk/tests/buffer/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/tests/buffer/Makefile.am	Sat Mar 21 11:26:11 2009
@@ -0,0 +1,50 @@
+# The test program returns 'success' if all buffer tests passed
+TESTS = buffer-tests-results.sh
+buffer-tests-results.sh: buffer-tests-report
+
+
+# Always build buffer-test to catch compilation problems early
+BUILT_SOURCES = buffer-tests.inc
+noinst_PROGRAMS = buffer-test$(EXEEXT)
+AM_CPPFLAGS =							\
+	-I$(top_srcdir)						\
+	-I$(top_srcdir)/gegl					\
+	-I$(top_srcdir)/gegl/buffer				\
+	-I$(top_srcdir)/gegl/property-types			\
+	-I$(top_srcdir)/gegl/operation				\
+	@DEP_CFLAGS@ @BABL_CFLAGS@
+
+buffer_test_SOURCES =						\
+	buffer-test.c
+
+buffer_test_LDADD = 						\
+	$(top_builddir)/gegl/libgegl- GEGL_API_VERSION@.la	\
+	@DEP_LIBS@ @BABL_LIBS@
+
+
+# Our custom target rules
+buffer-tests.inc: $(buffer_test_SOURCES) Makefile.am tests/*.c
+	echo '/* this file is generated by the build system */' > $@
+	for TEST in  `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
+	     echo "#define TEST() static gchar * $$TEST (void)" >> $@;\
+	     echo "#include \"tests/"$$TEST".c\"" >> $@;\
+	     echo "#undef TEST" >> $@;\
+	done;
+	echo 'typedef gchar *(*TestFunc) ();TestFunc tests[]={' >> $@
+	for TEST in  `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
+	     echo $$TEST, >> $@;\
+	done;
+	echo '};' >> $@
+	echo 'static gchar *test_names[]={' >> $@
+	for TEST in  `ls tests/*.c -1|sed -e s:tests/:: -e s:\\\.c::`; do \
+	     echo \"$$TEST\", >> $@;\
+	done;
+	echo '};' >> $@
+
+buffer-tests-report: buffer-test$(EXEEXT)
+	-./buffer-test$(EXEEXT)
+	diff -s -r -U 50 reference/ output/ > buffer-tests-report; true
+
+
+# Don't forget to clean
+CLEANFILES = buffer-tests.inc buffer-tests-report

Added: trunk/tests/buffer/buffer-tests-results.sh
==============================================================================
--- (empty file)
+++ trunk/tests/buffer/buffer-tests-results.sh	Sat Mar 21 11:26:11 2009
@@ -0,0 +1,12 @@
+#!/bin/sh
+total_tests=`ls -1 reference | wc -l`
+successful_tests=`cat buffer-tests-report | grep identical | wc -l`
+
+echo $successful_tests of $total_tests tests succesful.
+
+if [ $total_tests -eq $successful_tests ]
+then
+exit 0;
+else
+exit -1;
+fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]