tracker r1651 - branches/indexer-split
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1651 - branches/indexer-split
- Date: Thu, 12 Jun 2008 11:11:40 +0000 (UTC)
Author: ifrade
Date: Thu Jun 12 11:11:40 2008
New Revision: 1651
URL: http://svn.gnome.org/viewvc/tracker?rev=1651&view=rev
Log:
Added initial unit test support
Added:
branches/indexer-split/Makefile.decl
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/configure.ac
Added: branches/indexer-split/Makefile.decl
==============================================================================
--- (empty file)
+++ branches/indexer-split/Makefile.decl Thu Jun 12 11:11:40 2008
@@ -0,0 +1,64 @@
+#
+# Testing rules for make
+# Original file: http://svn.gnome.org/svn/glib/trunk/Makefile.decl
+#
+# test: run all tests in cwd and subdirs
+# 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
+#
+
+GTESTER = gtester # for non-GLIB packages
+GTESTER_REPORT = gtester-report
+
+# initialize variables for unconditional += appending
+TEST_PROGS =
+
+### testing rules
+
+# test: run all tests in cwd and subdirs
+test: ${TEST_PROGS}
+ @ test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
+ @ for subdir in $(SUBDIRS) . ; do \
+ test "$$subdir" = "." -o "$$subdir" = "po" || \
+ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+ done
+# 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 ; \
+ 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 ; \
+ 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
+# run make test as part of make check
+check-local: test
Modified: branches/indexer-split/configure.ac
==============================================================================
--- branches/indexer-split/configure.ac (original)
+++ branches/indexer-split/configure.ac Thu Jun 12 11:11:40 2008
@@ -208,6 +208,45 @@
IT_PROG_INTLTOOL([0.35.0])
####################################################################
+# Check if glib includes GTests framework
+#
+# If glib is installed in a non-standard location (like /opt/xxx):
+# * PKG_CONFIG_PATH must be set correctly
+# * glib binaries must be in the PATH (i.e PATH=$PATH:/opt/xxx/bin)
+####################################################################
+GLIB_WITH_UNIT_TESTING=2.15.0
+
+AC_ARG_ENABLE(unit_tests,
+ AS_HELP_STRING([--enable-unit-tests=@<:@no/yes/auto@:>@],
+ [Enable unit tests (if available)]), ,
+ [enable_unit_tests=auto])
+
+if test "x$enable_unit_tests" != "xno" ; then
+ glib_pkgconfig_tmp="glib-2.0 >= $GLIB_WITH_UNIT_TESTING"
+ PKG_CHECK_MODULES(GLIB_UNIT_TEST, $glib_pkgconfig_tmp, [have_unit_tests=yes], [have_unit_tests=no])
+
+ if test "x$have_unit_tests" = "xyes" ; then
+ AC_DEFINE(HAVE_UNIT_TEST, 1, [Unit test framework available in glib])
+ glib_pkgconfig=$glib_pkgconfig_tmp
+ AC_PATH_PROG(GTESTER, [gtester], [no] )
+ if test "x$GTESTER" = "xno" ; then
+ AC_MSG_ERROR([*** Gtester is not in the path])
+ fi
+ fi
+else
+ have_unit_tests=no
+ glib_pkgconfig=
+fi
+
+if test "x$enable_unit_tests" = "xyes"; then
+ if test "x$have_unit_tests" != "xyes"; then
+ AC_MSG_ERROR([Couldn't find unit test compatible glib.])
+ fi
+fi
+
+AM_CONDITIONAL(HAVE_UNIT_TESTS, test "x$have_unit_tests" = "xyes")
+
+####################################################################
# External QDBM check
####################################################################
@@ -710,7 +749,7 @@
enable warnings: $enable_warnings
enable debug symbols: $enable_debug_code
-
+ enable unit tests: $have_unit_tests
enable unac accent stripper: $enable_unac
support for file monitoring: gio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]