Merge lp:~mordred/libmemcached/add-gtest into lp:~tangent-org/libmemcached/trunk

Proposed by Monty Taylor
Status: Merged
Merged at revision: 867
Proposed branch: lp:~mordred/libmemcached/add-gtest
Merge into: lp:~tangent-org/libmemcached/trunk
Diff against target: 87 lines (+36/-0)
4 files modified
Makefile.am (+3/-0)
configure.ac (+1/-0)
tests/include.am (+11/-0)
tests/main.cc (+21/-0)
To merge this branch: bzr merge lp:~mordred/libmemcached/add-gtest
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+28777@code.launchpad.net

Description of the change

Add support for writing unittests using google test.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2010-06-13 16:21:08 +0000
3+++ Makefile.am 2010-06-29 17:10:47 +0000
4@@ -12,6 +12,7 @@
5 noinst_PROGRAMS =
6 include_HEADERS =
7 nobase_include_HEADERS =
8+check_PROGRAMS =
9 EXTRA_HEADERS =
10 BUILT_SOURCES=
11 EXTRA_DIST= \
12@@ -41,6 +42,8 @@
13 include example/include.am
14 include support/include.am
15
16+TESTS += ${check_PROGRAMS}
17+
18 check-local: test-no-outputdiff
19
20
21
22=== modified file 'configure.ac'
23--- configure.ac 2010-06-13 15:01:04 +0000
24+++ configure.ac 2010-06-29 17:10:47 +0000
25@@ -36,6 +36,7 @@
26
27 AC_CHECK_FUNCS([getline])
28
29+PANDORA_HAVE_LIBGTEST
30 PANDORA_HAVE_LIBEVENT
31 PANDORA_REQUIRE_PTHREAD
32 PANDORA_CXX_DEMANGLE
33
34=== modified file 'tests/include.am'
35--- tests/include.am 2010-06-13 16:43:30 +0000
36+++ tests/include.am 2010-06-29 17:10:47 +0000
37@@ -10,6 +10,10 @@
38
39 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
40
41+if HAVE_LIBGTEST
42+check_PROGRAMS += tests/unittests
43+endif
44+
45 if BUILD_LIBMEMCACHEDUTIL
46 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
47 endif
48@@ -38,6 +42,13 @@
49 noinst_LTLIBRARIES+= tests/libtest.la
50 tests_libtest_la_SOURCES= tests/test.c
51
52+tests_unittests_SOURCES= \
53+ tests/main.cc
54+tests_unittests_LDADD= \
55+ tests/libserver.la \
56+ libmemcached/libmemcachedinternal.la \
57+ ${TESTS_LDADDS} ${LTLIBGTEST}
58+
59 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
60 tests_testapp_SOURCES= tests/mem_functions.c
61 tests_testapp_DEPENDENCIES= \
62
63=== added file 'tests/main.cc'
64--- tests/main.cc 1970-01-01 00:00:00 +0000
65+++ tests/main.cc 2010-06-29 17:10:47 +0000
66@@ -0,0 +1,21 @@
67+/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
68+ * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
69+ *
70+ * Copyright (C) 2010 Monty Taylor
71+ *
72+ * All rights reserved.
73+ *
74+ * Use and distribution licensed under the BSD license. See
75+ * the COPYING file in the parent directory for full text.
76+ */
77+
78+#include "config.h"
79+
80+#include <gtest/gtest.h>
81+
82+
83+int main(int argc, char **argv)
84+{
85+ ::testing::InitGoogleTest(&argc, argv);
86+ return RUN_ALL_TESTS();
87+}

Subscribers

People subscribed via source and target branches

to all changes: