From b11161a7ffab99f5415e4136ce9ddd0bf6e1fa76 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 15 Mar 2012 11:30:13 -0500 Subject: Dummy commit on 'no rule' err. --- Makefile.am | 4 ++++ configure.ac | 20 +++++++++++++++++ m4/gtest.m4 | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/Makefile.am | 24 ++++++++++++++++++++ test/test-gtest.cpp | 13 +++++++++++ 5 files changed, 124 insertions(+) create mode 100644 m4/gtest.m4 create mode 100644 test/Makefile.am create mode 100644 test/test-gtest.cpp diff --git a/Makefile.am b/Makefile.am index 45c511a..1e8aa57 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,10 @@ SUBDIRS = \ data \ po +if BUILD_TESTS +SUBDIRS += test +endif + DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-deprecations dist-hook: diff --git a/configure.ac b/configure.ac index 159c740..a85773d 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,9 @@ AS_IF([test "x$enable_deprecations" = xno], [CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGTK_DISABLE_SINGLE_INCLUDES"] ) +# the Google Test targets are cpp +AC_PROG_CXX + ########################### # Dependencies ########################### @@ -68,6 +71,15 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) +########################### +# Test Dependencies +########################### + +AC_ARG_ENABLE([tests], + AC_HELP_STRING([--disable-tests], [Disable test scripts and tools]),, + [enable_tests=auto]) +AM_CONDITIONAL(BUILD_TESTS, test xyes = xyes) + ########################### # Status Provider Deps ########################### @@ -103,6 +115,13 @@ AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_CXXFLAGS) AC_SUBST(COVERAGE_LDFLAGS) +########################### +# Google Test framework +########################### + +m4_include([m4/gtest.m4]) +CHECK_GTEST + ########################### # Check to see if we're local ########################### @@ -192,6 +211,7 @@ data/icons/scalable/Makefile data/icons/scalable/status/Makefile data/icons/scalable/categories/Makefile po/Makefile.in +test/Makefile ]) ########################### diff --git a/m4/gtest.m4 b/m4/gtest.m4 new file mode 100644 index 0000000..2de334c --- /dev/null +++ b/m4/gtest.m4 @@ -0,0 +1,63 @@ +# Copyright (C) 2012 Canonical, Ltd. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Checks whether the gtest source is available on the system. Allows for +# adjusting the include and source path. Sets have_gtest=yes if the source is +# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and +# source location respectively. +AC_DEFUN([CHECK_GTEST], +[ + AC_ARG_WITH([gtest-include-path], + [AS_HELP_STRING([--with-gtest-include-path], + [location of the Google test headers])], + [GTEST_CPPFLAGS="-I$withval"]) + + AC_ARG_WITH([gtest-source-path], + [AS_HELP_STRING([--with-gtest-source-path], + [location of the Google test sources, defaults to /usr/src/gtest])], + [GTEST_SOURCE="$withval"], + [GTEST_SOURCE="/usr/src/gtest"]) + + GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE" + + AC_LANG_PUSH([C++]) + + tmp_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS" + + AC_CHECK_HEADER([gtest/gtest.h]) + + CPPFLAGS="$tmp_CPPFLAGS" + + AC_LANG_POP + + AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc] + [$GTEST_SOURCE/src/gtest_main.cc], + [have_gtest_source=yes], + [have_gtest_source=no]) + + AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \ + "x$have_gtest_source" = xyes], + [have_gtest=yes] + [AC_SUBST(GTEST_CPPFLAGS)] + [AC_SUBST(GTEST_SOURCE)], + [have_gtest=no]) +]) # CHECK_GTEST diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..fa7bace --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,24 @@ + +check_LIBRARIES = libgtest.a + +AM_CPPFLAGS = $(GTEST_CPPFLAGS) + +nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc +libgtest_a_CPPFLAGS = $(GTEST_CPPFLAGS) -w +libgtest_a_CXXFLAGS = $(AM_CXXFLAGS) + +libgtest_a_SOURCES = \ + $(GTEST_SOURCE)/src/gtest-all.cc \ + $(GTEST_SOURCE)/src/gtest-main.cc +lib_gtest_a_CPPFLAGS = \ + $(GTEST_CPPFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir) +libxorg_gtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) + +check_PROGRAMS = test_gtest + +test_gtest_SOURCES = test-gtest.cpp + +test_gtest_LDADD = \ + libgtest.a diff --git a/test/test-gtest.cpp b/test/test-gtest.cpp new file mode 100644 index 0000000..739a5c8 --- /dev/null +++ b/test/test-gtest.cpp @@ -0,0 +1,13 @@ + +#include +#include + + + + +int +main (int argc, char ** argv) +{ + printf("oheck\n"); + return 0; +} -- cgit v1.2.3