summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorLuis Pabon <lpabon@redhat.com>2014-02-20 13:50:19 -0500
committerVijay Bellur <vbellur@redhat.com>2014-03-06 04:10:46 -0800
commitc817c214033481fe59f9f44c325a9092dc337d07 (patch)
tree2259dd37b25b12fdd6a6db1738f0f2a73e71180d /configure.ac
parenta193f2262b93a06bf1a299f423d4ebaaa171a539 (diff)
build: GlusterFS Unit Test Framework
This patch will allow for developers to create unit tests for their code. Documentation has been added to the patch and is available here: doc/hacker-guide/en-US/markdown/unittest.md Also, unit tests are run when RPM is created. BUG: 1067059 Change-Id: I95cf8bb0354d4ca4ed4476a0f2385436a17d2369 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Signed-off-by: Luis Pabon <lpabon@redhat.com> Reviewed-on: http://review.gluster.org/7145 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Justin Clift <justin@gluster.org> Tested-by: Justin Clift <justin@gluster.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 13 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 69d25e4dad7..626f6f6289c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -630,6 +630,18 @@ AC_SUBST(HAVE_LINKAT)
dnl check for Monotonic clock
AC_CHECK_FUNC([clock_gettime], [has_monotonic_clock=yes], AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_WARN([System doesn't have monotonic clock using contrib])))
+dnl Add cmockery2 for unit testing
+AC_CONFIG_SUBDIRS([cmockery2])
+UNITTEST_CFLAGS='-g -Wall -DUNIT_TESTING=1 -DDEBUG -Werror -O0 --coverage'
+UNITTEST_CPPFLAGS='-I$(top_srcdir)/cmockery2/src'
+UNITTEST_LDADD='$(top_builddir)/cmockery2/libcmockery.la'
+UNITTEST_LDFLAGS=-lgcov
+CFLAGS="$CFLAGS ${UNITTEST_CPPFLAGS}"
+AC_SUBST(UNITTEST_CFLAGS)
+AC_SUBST(UNITTEST_CPPFLAGS)
+AC_SUBST(UNITTEST_LDADD)
+AC_SUBST(UNITTEST_LDFLAGS)
+
dnl Check for argp
AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
AC_CONFIG_SUBDIRS(argp-standalone)
@@ -900,7 +912,7 @@ CONTRIBDIR='$(top_srcdir)/contrib'
AC_SUBST(CONTRIBDIR)
GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
-GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
+GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid $(UNITTEST_CPPFLAGS)'
GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
AC_SUBST([GF_CPPFLAGS])