Signed-off-by: Chase Douglas <chase.doug...@canonical.com> --- configure.ac | 21 +++++- m4/xorg-gtest.m4 | 110 +++++++++++++++++++++++++++++++ test/Makefile.am | 2 +- test/integration/Makefile-xorg-gtest.am | 64 ++++++++++++++++++ test/integration/Makefile.am | 4 ++ 5 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 m4/xorg-gtest.m4 create mode 100644 test/integration/Makefile-xorg-gtest.am create mode 100644 test/integration/Makefile.am
diff --git a/configure.ac b/configure.ac index 97ceab1..ba10b2e 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,7 @@ AM_MAINTAINER_MODE # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])]) -XORG_MACROS_VERSION(1.14) +XORG_MACROS_VERSION(1.17) XORG_DEFAULT_OPTIONS XORG_WITH_DOXYGEN(1.6.1) XORG_CHECK_SGML_DOCTOOLS(1.8) @@ -45,6 +45,7 @@ XORG_WITH_XMLTO(0.0.20) XORG_WITH_FOP XORG_WITH_XSLTPROC XORG_ENABLE_UNIT_TESTS +XORG_ENABLE_INTEGRATION_TESTS XORG_LD_WRAP([optional]) m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])]) @@ -2143,6 +2144,23 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes]) AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes]) +dnl --------------------------------------------------------------------------- +dnl Tests section. +dnl --------------------------------------------------------------------------- + +if [test "x$XORG" = xyes && test "x$enable_integration_tests" != xno]; then + AC_PROG_CXX + CHECK_XORG_GTEST + AM_CONDITIONAL(ENABLE_XORG_GTEST_TESTS, [test "x$have_xorg_gtest" = xyes]) + if [test "x$have_xorg_gtest" = xyes]; then + AC_MSG_NOTICE([xorg-gtest is available, tests will be built]) + elif [test "x$enable_integration_tests" = xyes]; then + AC_MSG_ERROR([xorg-gtest is not available]) + else + AC_MSG_NOTICE([xorg-gtest is not available, tests will not be built]) + fi +fi + dnl and the rest of these are generic, so they're in config.h dnl dnl though, thanks to the passing of some significant amount of time, the @@ -2275,6 +2293,7 @@ hw/kdrive/linux/Makefile hw/kdrive/src/Makefile test/Makefile test/xi2/Makefile +test/integration/Makefile xserver.ent xorg-server.pc ]) diff --git a/m4/xorg-gtest.m4 b/m4/xorg-gtest.m4 new file mode 100644 index 0000000..062842c --- /dev/null +++ b/m4/xorg-gtest.m4 @@ -0,0 +1,110 @@ +# serial 2 + +# 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-source-path], + [AS_HELP_STRING([--with-gtest-source-path], + [location of the Google test sources, defaults to /usr/src/gtest])], + [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include"], + [GTEST_SOURCE="/usr/src/gtest"]) + + AC_ARG_WITH([gtest-include-path], + [AS_HELP_STRING([--with-gtest-include-path], + [location of the Google test headers])], + [GTEST_CPPFLAGS="-I$withval"]) + + GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE" + + AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc] + [$GTEST_SOURCE/src/gtest_main.cc], + [have_gtest=yes], + [have_gtest=no]) + + AS_IF([test "x$have_gtest_source" = xyes], + [AC_SUBST(GTEST_CPPFLAGS)] + [AC_SUBST(GTEST_SOURCE)]) +]) # _CHECK_GTEST + +# CHECK_XORG_GTEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Checks whether the xorg-gtest source is available on the system. Allows for +# adjusting the include and source path. Sets have_xorg_gtest=yes if the source +# is present. Sets XORG_GTEST_CPPFLAGS and XORG_GTEST_SOURCE to the preprocessor +# flags and source location respectively. Sets XORG_GTEST_LIBS to all the +# libraries needed to link against a built xorg-gtest library. +# +# Both default actions are no-ops. +AC_DEFUN([CHECK_XORG_GTEST], +[ + AC_REQUIRE([_CHECK_GTEST]) + + PKG_CHECK_EXISTS([xorg-gtest], + [have_xorg_gtest=yes], + [have_xorg_gtest=no]) + + XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest` + XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest` + XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS" + XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE" + + PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no]) + + # Check if we should include support for utouch-evemu + AC_ARG_WITH([evemu], + [AS_HELP_STRING([--with-evemu], + [support Linux input device recording playback + (default: enabled if available)])], + [], + [with_evemu=check]) + + AS_IF([test "x$with_evemu" = xyes], + [PKG_CHECK_MODULES(EVEMU, [utouch-evemu], [have_xorg_gtest_evemu=yes])], + [test "x$with_evemu" = xcheck], + [PKG_CHECK_MODULES(EVEMU, + [utouch-evemu], + [have_xorg_gtest_evemu=yes], + [have_xorg_gtest_evemu=no])]) + AS_IF([test "x$have_xorg_gtest_evemu" = xyes], + [XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"]) + + AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes], + [have_xorg_gtest=no]) + + AS_IF([test "x$have_xorg_gtest" = xyes], + [AC_SUBST(XORG_GTEST_SOURCE)] + [AC_SUBST(XORG_GTEST_CPPFLAGS)] + + # Get BASE_CXXFLAGS and STRICT_CXXFLAGS + [XORG_MACROS_VERSION(1.17)] + [AC_LANG_PUSH([C++])] + [XORG_STRICT_OPTION] + [AC_LANG_POP] + [$1], + [$2]) + +]) # CHECK_XORG_GTEST diff --git a/test/Makefile.am b/test/Makefile.am index b2a53aa..f58faed 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,7 +4,7 @@ noinst_PROGRAMS = list string touch if XORG # Tests that require at least some DDX functions in order to fully link # For now, requires xf86 ddx, could be adjusted to use another -SUBDIRS += xi2 +SUBDIRS += xi2 integration noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest endif check_LTLIBRARIES = libxservertest.la diff --git a/test/integration/Makefile-xorg-gtest.am b/test/integration/Makefile-xorg-gtest.am new file mode 100644 index 0000000..20983eb --- /dev/null +++ b/test/integration/Makefile-xorg-gtest.am @@ -0,0 +1,64 @@ +# 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. +# + +XORG_GTEST_BUILD_LIBS = \ + libgtest.a \ + libgtest_main.a \ + libxorg-gtest.a \ + libxorg-gtest_main.a + +# Here and below we compile without warnings (-w) because the projects using +# xorg-gtest will not want to see warnings or fail to build due to warnings in +# gtest or xorg-gtest. +nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc +libgtest_a_CPPFLAGS = $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) -w +libgtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) + +nodist_libgtest_main_a_SOURCES = $(GTEST_SOURCE)/src/gtest_main.cc +libgtest_main_a_CPPFLAGS = $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) -w +libgtest_main_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) + +nodist_libxorg_gtest_a_SOURCES = $(XORG_GTEST_SOURCE)/src/xorg-gtest-all.cpp +libxorg_gtest_a_CPPFLAGS = \ + $(XORG_GTEST_CPPFLAGS) \ + $(GTEST_CPPFLAGS) \ + $(AM_CPPFLAGS) \ + -w +libxorg_gtest_a_CXXFLAGS = \ + $(XORG_GTEST_CXXFLAGS) \ + $(GTEST_CXXFLAGS) \ + $(AM_CPPFLAGS) + +nodist_libxorg_gtest_main_a_SOURCES = \ + $(XORG_GTEST_SOURCE)/src/xorg-gtest_main.cpp +libxorg_gtest_main_a_CPPFLAGS = \ + $(XORG_GTEST_CPPFLAGS) \ + $(GTEST_CPPFLAGS) \ + $(AM_CPPFLAGS) \ + -w +libxorg_gtest_main_a_CXXFLAGS = \ + $(XORG_GTEST_CXXFLAGS) \ + $(GTEST_CXXFLAGS) \ + $(AM_CXXFLAGS) + +XORG_GTEST_LIBS = libxorg-gtest.a libgtest.a -lpthread $(X11_LIBS) +XORG_GTEST_MAIN_LIBS = libxorg-gtest_main.a diff --git a/test/integration/Makefile.am b/test/integration/Makefile.am new file mode 100644 index 0000000..2028d35 --- /dev/null +++ b/test/integration/Makefile.am @@ -0,0 +1,4 @@ +if ENABLE_XORG_GTEST_TESTS +include $(top_srcdir)/test/integration/Makefile-xorg-gtest.am +noinst_LIBRARIES = $(XORG_GTEST_BUILD_LIBS) +endif -- 1.7.9.5 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel