Added gtest unittest support.
authorMonty Taylor <mordred@inaugust.com>
Tue, 29 Jun 2010 16:50:25 +0000 (09:50 -0700)
committerMonty Taylor <mordred@inaugust.com>
Tue, 29 Jun 2010 16:50:25 +0000 (09:50 -0700)
Makefile.am
configure.ac
tests/include.am
tests/main.cc [new file with mode: 0644]

index d2acebaa4658258582dd8e4b712c90d91b5223f1..d855c8f493ba29053ac88e4af8f9605065283fea 100644 (file)
@@ -12,6 +12,7 @@ noinst_LTLIBRARIES =
 noinst_PROGRAMS =
 include_HEADERS =
 nobase_include_HEADERS =
+check_PROGRAMS = 
 EXTRA_HEADERS =
 BUILT_SOURCES=
 EXTRA_DIST= \
@@ -41,6 +42,8 @@ include tests/include.am
 include example/include.am
 include support/include.am
 
+TESTS += ${check_PROGRAMS}
+
 check-local: test-no-outputdiff
 
 
index 2e0a5a93eb8d6fdd21cdef86fe51cd34b6f40bb6..0db997591b1b3ce2731459b6edabb36b6f03ae46 100644 (file)
@@ -36,6 +36,7 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
 
 AC_CHECK_FUNCS([getline])
 
+PANDORA_HAVE_LIBGTEST
 PANDORA_HAVE_LIBEVENT
 PANDORA_REQUIRE_PTHREAD
 PANDORA_CXX_DEMANGLE
index d82538b96234d1d3042ff0b665dcdf8e65890b42..21450f6df26178039889229c793f144f223fc2c4 100644 (file)
@@ -10,6 +10,10 @@ DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
 
 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
 
+if HAVE_LIBGTEST
+check_PROGRAMS += tests/unittests
+endif
+
 if BUILD_LIBMEMCACHEDUTIL
 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
 endif
@@ -38,6 +42,13 @@ tests_libserver_la_SOURCES= tests/server.c
 noinst_LTLIBRARIES+= tests/libtest.la
 tests_libtest_la_SOURCES= tests/test.c
 
+tests_unittests_SOURCES= \
+                        tests/main.cc
+tests_unittests_LDADD= \
+                      tests/libserver.la \
+                      libmemcached/libmemcachedinternal.la \
+                      ${TESTS_LDADDS} ${LTLIBGTEST}
+
 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
 tests_testapp_SOURCES= tests/mem_functions.c
 tests_testapp_DEPENDENCIES= \
diff --git a/tests/main.cc b/tests/main.cc
new file mode 100644 (file)
index 0000000..7e575c3
--- /dev/null
@@ -0,0 +1,21 @@
+/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+ *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ *  Copyright (C) 2010 Monty Taylor
+ *
+ *  All rights reserved.
+ *
+ *  Use and distribution licensed under the BSD license.  See
+ *  the COPYING file in the parent directory for full text.
+ */
+
+#include "config.h"
+
+#include <gtest/gtest.h>
+
+
+int main(int argc, char **argv)
+{
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}