[evolution-data-server/wip/gtester: 5/5] Bug 695688 - run tests using gtester and produce html report



commit 79e2e66d1ff3d1a6114f46e018368a4c34ca3495
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Wed Mar 13 16:32:20 2013 +0100

    Bug 695688 - run tests using gtester and produce html report

 Makefile.am                                  |    5 ++
 tests/Makefile.am                            |    1 +
 tests/Makefile.gtester                       |   63 ++++++++++++++++++++++++++
 tests/libebook/Makefile.am                   |    1 +
 tests/libebook/client/Makefile.am            |    1 +
 tests/libebook/vcard/Makefile.am             |    1 +
 tests/libecal/Makefile.am                    |    1 +
 tests/libecal/client/Makefile.am             |    1 +
 tests/libedata-cal/Makefile.am               |    1 +
 tests/libedataserver/Makefile.am             |    1 +
 tests/test-server-utils/Makefile.am          |    1 +
 tests/test-server-utils/services/Makefile.am |    1 +
 12 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 85a52d2..06e3956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,3 +103,8 @@ MAINTAINERCLEANFILES =                                      \
        $(srcdir)/po/remove-potcdate.sin
 
 -include $(top_srcdir)/git.mk
+
+test-report perf-report full-report:
+       @cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
+
+.PHONY:test-report perf-report full-report
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d59b456..97a1891 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,3 +3,4 @@ SUBDIRS = test-server-utils libedataserver libebook libecal libedata-cal
 @GNOME_CODE_COVERAGE_RULES@
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/Makefile.gtester b/tests/Makefile.gtester
new file mode 100644
index 0000000..37868c6
--- /dev/null
+++ b/tests/Makefile.gtester
@@ -0,0 +1,63 @@
+### testing rules
+
+# test: run all tests in cwd and subdirs
+test: test-nonrecursive
+       @ for subdir in $(SUBDIRS) . ; do \
+           test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "docs" || \
+           ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+         done
+
+# test-nonrecursive: run tests only in cwd
+test-nonrecursive: ${TESTS}
+       @test -z "${TESTS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 
256)) gtester ${TESTS}
+
+# 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:   ${TESTS}
+       @test -z "${TESTS}" || { \
+         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 $$test_options -o test-report.xml ${TESTS} || true ; \
+         elif test -n "${TESTS}" ; then \
+           gtester $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TESTS} || true ; \
+         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" -o "$$subdir" = "docs" || \
+           ( 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/tests/libebook/Makefile.am b/tests/libebook/Makefile.am
index 7b365bf..93ba82f 100644
--- a/tests/libebook/Makefile.am
+++ b/tests/libebook/Makefile.am
@@ -153,3 +153,4 @@ test_stress_bookviews_LDADD=$(TEST_LIBS)
 test_stress_bookviews_CPPFLAGS=$(TEST_CPPFLAGS)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libebook/client/Makefile.am b/tests/libebook/client/Makefile.am
index 2cb283d..dd55e25 100644
--- a/tests/libebook/client/Makefile.am
+++ b/tests/libebook/client/Makefile.am
@@ -137,3 +137,4 @@ test_client_stress_views_LDADD=$(TEST_LIBS)
 test_client_stress_views_CPPFLAGS=$(TEST_CPPFLAGS)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libebook/vcard/Makefile.am b/tests/libebook/vcard/Makefile.am
index 91f39f1..a27d23f 100644
--- a/tests/libebook/vcard/Makefile.am
+++ b/tests/libebook/vcard/Makefile.am
@@ -17,3 +17,4 @@ dump_vcard_LDADD =                                            \
 EXTRA_DIST=1.vcf 2.vcf 3.vcf 4.vcf 5.vcf 6.vcf 7.vcf 8.vcf 9.vcf 10.vcf 11.vcf
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libecal/Makefile.am b/tests/libecal/Makefile.am
index 81b886a..0ba1aa4 100644
--- a/tests/libecal/Makefile.am
+++ b/tests/libecal/Makefile.am
@@ -160,3 +160,4 @@ test_scripts =                      \
        cleanup.sh
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libecal/client/Makefile.am b/tests/libecal/client/Makefile.am
index e1da501..58db142 100644
--- a/tests/libecal/client/Makefile.am
+++ b/tests/libecal/client/Makefile.am
@@ -104,3 +104,4 @@ test_client_stress_views_LDADD=$(TEST_LIBS)
 test_client_stress_views_CPPFLAGS=$(TEST_CPPFLAGS)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libedata-cal/Makefile.am b/tests/libedata-cal/Makefile.am
index 145c13b..b27c65e 100644
--- a/tests/libedata-cal/Makefile.am
+++ b/tests/libedata-cal/Makefile.am
@@ -43,3 +43,4 @@ test_intervaltree_CPPFLAGS = $(test_CPPFLAGS)
 test_intervaltree_LDADD = $(test_LDADD)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/libedataserver/Makefile.am b/tests/libedataserver/Makefile.am
index 983c2bb..ce64549 100644
--- a/tests/libedataserver/Makefile.am
+++ b/tests/libedataserver/Makefile.am
@@ -56,3 +56,4 @@ e_user_prompter_test_LDADD = $(top_builddir)/libebackend/libebackend-1.2.la $(te
 endif
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/test-server-utils/Makefile.am b/tests/test-server-utils/Makefile.am
index 28859aa..642faa7 100644
--- a/tests/test-server-utils/Makefile.am
+++ b/tests/test-server-utils/Makefile.am
@@ -56,3 +56,4 @@ test_fixture_LDADD    = $(common_libs) libetestserverutils.la
 test_fixture_SOURCES  = test-fixture.c
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester
diff --git a/tests/test-server-utils/services/Makefile.am b/tests/test-server-utils/services/Makefile.am
index f3d5287..dce8ccd 100644
--- a/tests/test-server-utils/services/Makefile.am
+++ b/tests/test-server-utils/services/Makefile.am
@@ -4,3 +4,4 @@ EXTRA_DIST = \
        org.gnome.evolution.dataserver.Sources.service.in
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/tests/Makefile.gtester


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