subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1452120 - in /subversion/branches/gtest_addition: ./ build/generator/ doc/programmer/ subversion/bindings/cxxhl/gtests/
Date Sun, 03 Mar 2013 20:37:40 GMT
Author: gbg
Date: Sun Mar  3 20:37:39 2013
New Revision: 1452120

URL: http://svn.apache.org/r1452120
Log:
Add the optional dependency Googletest (aka Gtest) to be compiled by
the build system.
 
* trunk/get-deps.sh (gtest): change gtest dir to libgtest and
  add user information.

* trunk/build/generator/gen_base.py (TargetLinked.add_dependencies): 
  Add .cc extension.

* trunk/gen-make.py (_usage_exit): add gtest flag help info. 

* trunk/Makefile.in(): various entries for gtest flags
 
* trunk/build.conf (install): Add Gtest target.

* trunk/configure.ac (): Add AC_ARG_ENABLE command hook and test
  (build rules): add gtest build rules

* INSTALL (Dependency Overview): add entry for Gtest
  (Dependencies in Detail): add entry for Gtest

* doc/programmer/gtest-guide.txt(): Documentation for Subversion's
  installation of Gtest.

* subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp(): Sample test
  for gtest.

* subversion/bindings/cxxhl/gtests/Makefile(): Makefile for sample
  test for gtest.
  

  

Added:
    subversion/branches/gtest_addition/doc/programmer/gtest-guide.txt
    subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/
    subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp
    subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/Makefile
Modified:
    subversion/branches/gtest_addition/INSTALL
    subversion/branches/gtest_addition/Makefile.in
    subversion/branches/gtest_addition/build.conf
    subversion/branches/gtest_addition/build/generator/gen_base.py
    subversion/branches/gtest_addition/configure.ac
    subversion/branches/gtest_addition/gen-make.py
    subversion/branches/gtest_addition/get-deps.sh

Modified: subversion/branches/gtest_addition/INSTALL
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/INSTALL?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/INSTALL (original)
+++ subversion/branches/gtest_addition/INSTALL Sun Mar  3 20:37:39 2013
@@ -153,6 +153,12 @@ I.    INTRODUCTION
          configured via auto-props or the mime-types-file option
          take precedence.
 
+      * Googletest aka Gtest (OPTIONAL)
+  
+         This optional package is used by the tests for Subversions'
+         C++ bindings.
+
+
   C. Dependencies in Detail
 
       Subversion depends on a number of third party tools and libraries.
@@ -566,6 +572,13 @@ I.    INTRODUCTION
 
         --with-libmagic
 
+      22. Googletest (OPTIONAL)
+
+      Googletest can be installed and built in-tree by invoking 
+
+      $ ./get-dep.sh gtest
+      $ ./configure --with-gtest 
+
   D. Documentation
 
       The primary documentation for Subversion is the free book

Modified: subversion/branches/gtest_addition/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/Makefile.in?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/Makefile.in (original)
+++ subversion/branches/gtest_addition/Makefile.in Sun Mar  3 20:37:39 2013
@@ -134,6 +134,8 @@ APACHE_INCLUDES = @APACHE_INCLUDES@
 APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
 APACHE_LDFLAGS = @APACHE_LDFLAGS@
 
+GTEST_INCLUDES = -Ilibgtest -Ilibgtest/include/ -Ilibgtest/include/gtest/internal -Ilibgtest/include/gtest
+
 SWIG = @SWIG@
 SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
 SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
@@ -182,9 +184,10 @@ SWIG_LDFLAGS = @SWIG_LDFLAGS@ $(EXTRA_SW
 
 COMPILE = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CMAINTAINERFLAGS) $(CFLAGS) $(INCLUDES)
 COMPILE_CXX = $(CXX) $(CXXMODEFLAGS) $(CPPFLAGS) $(CXXMAINTAINERFLAGS) $(CXXFLAGS) $(INCLUDES)
+COMPILE_GTEST_CXX = $(COMPILE_CXX) $(GTEST_INCLUDES) -o $@ -c 
 LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) $(LT_CFLAGS)
 LT_COMPILE_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS)
-
+LT_COMPILE_GTEST_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_FLAGS)
$(GTEST_INCLUDES) -o $@ -c 
 # Execute a command that loads libraries from the build dir
 LT_EXECUTE = $(LIBTOOL) $(LTFLAGS) --mode=execute `for f in $(abs_builddir)/subversion/*/*.la;
do echo -dlopen $$f; done`
 
@@ -208,6 +211,8 @@ LINK = $(LIBTOOL) $(LTFLAGS) --mode=link
 LINK_LIB = $(LINK) $(LT_SO_VERSION)
 LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS)
-rpath $(libdir)
 LINK_CXX_LIB = $(LINK_CXX) $(LT_SO_VERSION)
+## LINK_GTEST_CXX = ar -rv libgtest.a src/gtest-all.lo
+LINK_GTEST_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS)
-rpath $(libdir)
 
 # special link rule for mod_dav_svn
 LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS)
-rpath $(APACHE_LIBEXECDIR) -avoid-version -module $(APACHE_LDFLAGS)

Modified: subversion/branches/gtest_addition/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/build.conf?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/build.conf (original)
+++ subversion/branches/gtest_addition/build.conf Sun Mar  3 20:37:39 2013
@@ -409,7 +409,6 @@ type = sql-header
 path = subversion/libsvn_subr
 sources = internal_statements.sql
 
-
 # ----------------------------------------------------------------------------
 #
 # TARGETS FOR I18N SUPPORT
@@ -657,6 +656,24 @@ install = tests
 compile-cmd = $(COMPILE_CXXHL_CXX)
 link-cmd = $(LINK_CXX)
 
+
+# ----------------------------------------------------------------------------
+#
+# Gtest targets
+#
+
+# renamed from gtest to libgtest because libtool couldn't output 
+# a library that didn't have the prefix 'lib'
+[libgtest] 
+description = Gtest Test Suite
+type = lib
+path = libgtest
+headers = include/gtest
+sources = src/gtest-all.cc
+install = libgtest-install
+compile-cmd = $(LT_COMPILE_GTEST_CXX)
+link-cmd = $(LINK_CXX)
+
 # ----------------------------------------------------------------------------
 #
 # TESTING TARGETS

Modified: subversion/branches/gtest_addition/build/generator/gen_base.py
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/build/generator/gen_base.py?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/build/generator/gen_base.py (original)
+++ subversion/branches/gtest_addition/build/generator/gen_base.py Sun Mar  3 20:37:39 2013
@@ -431,6 +431,8 @@ class TargetLinked(Target):
         if glob.glob(src):
           if src[-2:] == '.c':
             objname = src[:-2] + self.objext
+          elif src[-3:] == '.cc':
+            objname = src[:-3] + self.objext
           elif src[-4:] == '.cpp':
             objname = src[:-4] + self.objext
           else:

Modified: subversion/branches/gtest_addition/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/configure.ac?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/configure.ac (original)
+++ subversion/branches/gtest_addition/configure.ac Sun Mar  3 20:37:39 2013
@@ -625,6 +625,22 @@ fi
 AC_SUBST(SVN_GNOME_KEYRING_INCLUDES)
 AC_SUBST(SVN_GNOME_KEYRING_LIBS)
 
+dnl gtest -----------------
+AC_ARG_ENABLE([gtest],
+  [AS_HELP_STRING([--enable-gtest],
+                  [Enable tests using the Google C++ Testing Framework.
+                  ])],
+  enable_gtest=yes,
+  [])
+
+if test "$enable_gtest" = "yes"; then
+  AC_MSG_RESULT([yes])
+  AC_DEFINE([HAVE_GTEST], [1], 
+            [Is gtest enabled?])
+else
+  AC_MSG_RESULT([no])
+fi
+AC_SUBST([HAVE_GTEST])
 
 dnl Ev2 experimental features ----------------------
 dnl Note: The Ev2 implementations will be built unconditionally, but by
@@ -831,6 +847,12 @@ if test "$svn_lib_kwallet" = "yes"; then
   INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-kwallet-lib"
 fi
 
+if test "$enable_gtest" = "yes"; then
+  BUILD_RULES="$BUILD_RULES libgtest"
+  INSTALL_RULES="`echo $INSTALL_RULES | $SED 's/install-lib/install-lib install-gtest/'`"
+  INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-gtest"
+fi
+
 if test "$found_gnome_keyring" = "yes"; then
   BUILD_RULES="$BUILD_RULES gnome-keyring-lib"
   INSTALL_RULES="`echo $INSTALL_RULES | $SED 's/install-lib/install-lib install-gnome-keyring-lib/'`"

Added: subversion/branches/gtest_addition/doc/programmer/gtest-guide.txt
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/doc/programmer/gtest-guide.txt?rev=1452120&view=auto
==============================================================================
--- subversion/branches/gtest_addition/doc/programmer/gtest-guide.txt (added)
+++ subversion/branches/gtest_addition/doc/programmer/gtest-guide.txt Sun Mar  3 20:37:39
2013
@@ -0,0 +1,53 @@
+Googletest Suite for Subversion
+---------------------------------
+
+0. Introduction
+1. Setting up 
+2. Literature 
+3. Example test case
+
+0. Introduction
+----------------
+Googletest is an external package that is downloaded and
+compiled on request, as part of a regular compilations.
+
+From the Googletest Project page:
+"Google's framework for writing C++ tests on a variety of platforms
+(Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian). Based on
+the xUnit architecture. Supports automatic test discovery, a rich set
+of assertions, user-defined assertions, death tests, fatal and
+non-fatal failures, value- and type-parameterized tests, various
+options for running the tests, and XML test report generation."
+
+1. Setting up 
+--------------
+
+To configure Subversion to use Googletest, type
+
+./get-dep.sh gtest
+./autogen.sh
+./configure --enable-gtest <your other options here>
+
+this sets up gtest in the /trunk/libgtest directory.
+
+Note that currently autogen.sh issues header warnings and the
+configure script prints spurious errormessages of the form ""the
+option --enable-gtest is not recognised."
+
+Please ignore them, this does not interfere with the functionality of
+Googletest at all, and everything is being installed correctly.
+
+
+2. Literature 
+-------------
+
+Googletest homepage: 
+http://code.google.com/p/googletest/
+
+Short tutorial and cheatsheet: 
+http://www.ibm.com/developerworks/aix/library/au-googletestingframework.html
+
+3. Simple example test case
+----------------------------
+
+Please see subversion/bindings/cxxhl/gtests/* for a sample set up.

Modified: subversion/branches/gtest_addition/gen-make.py
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/gen-make.py?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/gen-make.py (original)
+++ subversion/branches/gtest_addition/gen-make.py Sun Mar  3 20:37:39 2013
@@ -213,6 +213,8 @@ def _usage_exit(err=None):
   print("")
   print("  --with-apr_memcache=DIR")
   print("           the apr_memcache sources are in DIR")
+  print("  --with-gtest")
+  print("           enable Gtest")
   sys.exit(1)
 
 
@@ -261,7 +263,7 @@ if __name__ == '__main__':
                             'disable-shared',
                             'installed-libs=',
                             'vsnet-version=',
-
+                            'with-gtest',
                             # Keep distributions that help by adding a path
                             # working. On unix this would be filtered by
                             # configure, but on Windows gen-make.py is used

Modified: subversion/branches/gtest_addition/get-deps.sh
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/get-deps.sh?rev=1452120&r1=1452119&r2=1452120&view=diff
==============================================================================
--- subversion/branches/gtest_addition/get-deps.sh (original)
+++ subversion/branches/gtest_addition/get-deps.sh Sun Mar  3 20:37:39 2013
@@ -116,7 +116,13 @@ get_gtest() {
 
     unzip -q $TEMPDIR/$GTEST.zip
 
-    mv $GTEST gtest
+    mv $GTEST libgtest
+    echo "Gtest has been installed, please note:"
+    echo "autogen.sh will issue spurious header warnings."
+    echo "./configure --enable-gtest will issue repeated spurious warnings that"
+    echo "the option --enable-gtest is not recognsed."
+    echo "The documentation for the usage of Gtest in Subversion is located in "
+    echo "doc/programmer/gtest-guide.txt"
 }
 
 # main()

Added: subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp?rev=1452120&view=auto
==============================================================================
--- subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp
(added)
+++ subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/GtestAcceptance.cpp
Sun Mar  3 20:37:39 2013
@@ -0,0 +1,33 @@
+/*
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ */
+  
+#include <iostream>
+#include <gtest/gtest.h>
+
+TEST(GtestAcceptance, Pass) {
+  EXPECT_EQ(0, 0);
+}
+
+// Note that it appears that Googletest doesn't support an XFAIL
+// decorator, which would fit nicely for this second test.
+TEST(GtestAcceptance, Fail) {
+  EXPECT_EQ(0, 1);
+}

Added: subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/Makefile
URL: http://svn.apache.org/viewvc/subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/Makefile?rev=1452120&view=auto
==============================================================================
--- subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/Makefile (added)
+++ subversion/branches/gtest_addition/subversion/bindings/cxxhl/gtests/Makefile Sun Mar 
3 20:37:39 2013
@@ -0,0 +1,34 @@
+#
+# subversion/bindings/cxxhl/gtests/Makefile:  test Makefile for Subversion
+# cxxhl bindings integration with Googletest
+#
+# ====================================================================
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements.  See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership.  The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied.  See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+# ====================================================================
+#
+## Proof of concept file, to show that GtestAcceptance.cpp is a valid 
+## Googletest test file.
+##
+## Not likely to ever be part of a final commit to TRUNK
+
+CPPFLAGS := -Wall -O2 -I../../../../libgtest/include -I../../../../libgtest 
+
+all: GtestAcceptance.cpp
+	g++ ${CPPFLAGS} GtestAcceptance.cpp \
+	../../../../libgtest/src/gtest_main.cc \
+	../../../../libgtest/.libs/libgtest-1.a -lpthread -o mytest



Mime
View raw message