[dconf/wip/reorg: 470/498] add gtester support



commit bb4f8d75af0a08b1e5262986a75042874da29850
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jul 5 23:25:39 2012 -0400

    add gtester support

 Makefile.am           |    2 +
 Makefile.gtester      |   66 +++++++++++++++++++++++++++++++++++++++++++++++++
 bin/Makefile.am       |    2 +
 client/Makefile.am    |    2 +
 common/Makefile.am    |    2 +
 dbus-1/Makefile.am    |    2 +
 docs/Makefile.am      |    2 +
 editor/Makefile.am    |    2 +
 engine/Makefile.am    |    2 +
 gdbus/Makefile.am     |    2 +
 gsettings/Makefile.am |    2 +
 gvdb/Makefile.am      |    2 +
 service/Makefile.am   |    2 +
 tests/Makefile.am     |    2 +
 14 files changed, 92 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 72ba072..a30c0de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+include Makefile.gtester
+
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
 SUBDIRS = gvdb common engine service gdbus gsettings dbus-1 tests client bin docs
diff --git a/Makefile.gtester b/Makefile.gtester
new file mode 100644
index 0000000..fdc0010
--- /dev/null
+++ b/Makefile.gtester
@@ -0,0 +1,66 @@
+# initialize variables for unconditional += appending
+TEST_PROGS =
+
+### testing rules
+
+# test: run all tests in cwd and subdirs
+test: test-nonrecursive
+	@ for subdir in $(SUBDIRS) . ; do \
+	    test "$$subdir" = "." -o "$$subdir" = "po" || \
+	    ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+	  done
+
+# test-nonrecursive: run tests only in cwd
+test-nonrecursive: ${TEST_PROGS}
+	@test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) gtester --verbose ${TEST_PROGS}
+
+# test-report: run tests in subdirs and generate report
+# perf-report: run tests in subdirs with -m perf and generate report
+# full-report: like test-report: with -m perf and -m slow
+test-report perf-report full-report:	${TEST_PROGS}
+	@test -z "${TEST_PROGS}" || { \
+	  case $@ in \
+	  test-report) test_options="-k";; \
+	  perf-report) test_options="-k -m=perf";; \
+	  full-report) test_options="-k -m=perf -m=slow";; \
+	  esac ; \
+	  if test -z "$$GTESTER_LOGDIR" ; then	\
+	    gtester --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
+	  elif test -n "${TEST_PROGS}" ; then \
+	    gtester --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
+	  fi ; \
+	}
+	@ ignore_logdir=true ; \
+	  if test -z "$$GTESTER_LOGDIR" ; then \
+	    GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
+	    ignore_logdir=false ; \
+	  fi ; \
+	  if test -d "$(top_srcdir)/.git" ; then \
+	    REVISION=`git describe` ; \
+	  else \
+	    REVISION=$(VERSION) ; \
+	  fi ; \
+	  for subdir in $(SUBDIRS) . ; do \
+	    test "$$subdir" = "." -o "$$subdir" = "po" || \
+	    ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+	  done ; \
+	  $$ignore_logdir || { \
+	    echo '<?xml version="1.0"?>'              > $  xml ; \
+	    echo '<report-collection>'               >> $  xml ; \
+	    echo '<info>'                            >> $  xml ; \
+	    echo '  <package>$(PACKAGE)</package>'   >> $  xml ; \
+	    echo '  <version>$(VERSION)</version>'   >> $  xml ; \
+	    echo "  <revision>$$REVISION</revision>" >> $  xml ; \
+	    echo '</info>'                           >> $  xml ; \
+	    for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
+	      sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $  xml ; \
+	    done ; \
+	    echo >> $  xml ; \
+	    echo '</report-collection>' >> $  xml ; \
+	    rm -rf "$$GTESTER_LOGDIR"/ ; \
+	    gtester-report --version 2>/dev/null 1>&2 ; test "$$?" != 0 || gtester-report $  xml >$  html ; \
+	  }
+.PHONY: test test-report perf-report full-report test-nonrecursive
+
+# run tests in cwd as part of make check
+check-local: test-nonrecursive
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 792b242..5d5de60 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = -Wall -Wmissing-prototypes -Wwrite-strings
 CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client -I$(top_srcdir)/gvdb $(gio_CFLAGS)
diff --git a/client/Makefile.am b/client/Makefile.am
index 119bf92..983208b 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
 CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(gio_CFLAGS)
diff --git a/common/Makefile.am b/common/Makefile.am
index 5c98e55..29c4667 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 dconfinclude_HEADERS = \
 	dconf-paths.h
 
diff --git a/dbus-1/Makefile.am b/dbus-1/Makefile.am
index 78244e8..74ec56d 100644
--- a/dbus-1/Makefile.am
+++ b/dbus-1/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(dbus_CFLAGS) $(glib_CFLAGS)
 
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 4e11f65..cf13ffc 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 include gtk-doc.make
 
 DOC_MODULE = dconf
diff --git a/editor/Makefile.am b/editor/Makefile.am
index e52d833..8928acc 100644
--- a/editor/Makefile.am
+++ b/editor/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 bin_PROGRAMS = dconf-editor
 
 AM_CFLAGS = $(gtk_CFLAGS) $(gmodule_CFLAGS) $(libxml_CFLAGS) -I$(top_srcdir)/common -I$(top_srcdir)/client -DPKGDATADIR=\"@datadir@/dconf-editor\"
diff --git a/engine/Makefile.am b/engine/Makefile.am
index 234a412..d3f01c6 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 noinst_LIBRARIES = libdconf-engine.a
 
 libdconf_engine_a_CFLAGS = -fPIC -DPIC -Wall
diff --git a/gdbus/Makefile.am b/gdbus/Makefile.am
index 3302c19..0797787 100644
--- a/gdbus/Makefile.am
+++ b/gdbus/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 noinst_LIBRARIES = libdconf-gdbus.a
 INCLUDES = $(glib_CFLAGS) -I../engine -I../common
 libdconf_gdbus_a_CFLAGS = -Wall -fPIC -DPIC
diff --git a/gsettings/Makefile.am b/gsettings/Makefile.am
index 7baf7c2..22c07e0 100644
--- a/gsettings/Makefile.am
+++ b/gsettings/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(gio_CFLAGS)
 
diff --git a/gvdb/Makefile.am b/gvdb/Makefile.am
index 47e77c8..0fe3bb0 100644
--- a/gvdb/Makefile.am
+++ b/gvdb/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 EXTRA_DIST = \
 	gvdb-format.h	\
 	gvdb-reader.h	\
diff --git a/service/Makefile.am b/service/Makefile.am
index 15e0937..eed852a 100644
--- a/service/Makefile.am
+++ b/service/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = $(gio_CFLAGS) -I$(top_srcdir)/gvdb -I$(top_srcdir)/common -Wall -Wmissing-prototypes -Wwrite-strings
 
 libexec_PROGRAMS = dconf-service
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e6cfab1..9fc871b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.gtester
+
 AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client $(gio_CFLAGS) -I$(top_srcdir)/dbus-1 $(dbus_CFLAGS)
 



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