[PATCH v2 1/3] Add xorg-gtest integration test framework
Peter Hutterer
peter.hutterer at who-t.net
Tue May 15 17:24:07 PDT 2012
On Tue, May 15, 2012 at 04:51:40PM -0700, Chase Douglas wrote:
> On 05/15/2012 04:18 PM, Peter Hutterer wrote:
> > On Tue, May 15, 2012 at 11:05:25AM -0700, Chase Douglas wrote:
[snip]
> >> +
> >> + 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
> >
> > does anyone actually use the term "Linux input device recording playback"
> > instead of just calling it evemu?
>
> I can see a BSD user not realizing that it's Linux only. This is a file
> copied from the xorg-gtest distribution (via aclocal), so if you want to
> change it send a patch there. But I don't see why a more verbose
> configure help string is a problem :).
mostly because I'd have no idea what "Linux input device recording playback"
is, whereas the term evemu is slowly becoming popular given that I stick it
into most bugreports these days.
> >> + (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"])
> >
> > no AC_DEFINE for HAVE_EVEMU? that seems to be the traditional way
> > might be worth having a test-config.h.in for hese things
>
> An AC_DEFINE would modify the compilation of every source file. This
> limits the macro definition only to those files that are compiled with
> XORG_GTEST_CPPFLAGS, which is the xorg-gtest implementation itself.
>
> This is an aclocal macro from xorg-gtest, so it shouldn't be modifying
> the build of the project itself.
>
> >> +
> >> + 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/integration/Makefile-xorg-gtest.am b/test/integration/Makefile-xorg-gtest.am
> >> new file mode 100644
> >> index 0000000..185381d
> >> --- /dev/null
> >> +++ b/test/integration/Makefile-xorg-gtest.am
> >> @@ -0,0 +1,61 @@
> >> +# 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
> >> +
> >> +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
> >
> > -w? really?
>
> Note that this is also another xorg-gtest file, so any changes would
> need to be patched there :).
>
> The reason for the -w here is that we don't want to cause warnings (and
> errors when built with -Werror) due to issues in xorg-gtest and gtest
> themselves. This flag is only used for building those sources. It isn't
> used for building any tests in the project that is using xorg-gtest.
can we somehow pop a comment in there? that wasn't obvious to me on first
sight. plus, I keep forgetting that the libs need to be re-built instead of
just linking to...
Cheers,
Peter
More information about the xorg-devel
mailing list