[PATCH v2 2/3] Add XInput 2.x integration test framework

Peter Hutterer peter.hutterer at who-t.net
Tue May 15 17:27:03 PDT 2012


On Tue, May 15, 2012 at 04:56:00PM -0700, Chase Douglas wrote:
> On 05/15/2012 04:26 PM, Peter Hutterer wrote:
> > On Tue, May 15, 2012 at 11:05:26AM -0700, Chase Douglas wrote:
> >> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> >> ---
> >> Changes since v1:
> >> * Split commit into XInput 2.x integration test framework and XIQueryPointer
> >>   test
> >>
> >>  configure.ac                 |   14 +++
> >>  test/integration/.gitignore  |    1 +
> >>  test/integration/Makefile.am |   24 ++++++
> >>  test/integration/xi2.cpp     |  194 ++++++++++++++++++++++++++++++++++++++++++
> >>  4 files changed, 233 insertions(+)
> >>  create mode 100644 test/integration/.gitignore
> >>  create mode 100644 test/integration/xi2.cpp
> >>
> >> diff --git a/configure.ac b/configure.ac
> >> index fe350c9..bc9f46f 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -2141,6 +2141,20 @@ if [test "x$XORG" = xyes && test "x$enable_integration_tests" != xno]; then
> >>      fi
> >>  fi
> >>  
> >> +PKG_CHECK_MODULES(TEST_X11, x11, have_test_x11=yes, have_test_x11=no)
> >> +PKG_CHECK_MODULES(TEST_XINPUT, [xi >= 1.6], have_test_xinput=yes, have_test_xinput=no)
> >> +
> >> +if [test "x$have_test_x11" != xyes]; then
> >> +    AC_MSG_NOTICE([libX11 not available, skipping input tests])
> >> +elif [test "x$have_test_xinput" != xyes]; then
> >> +    AC_MSG_NOTICE([libXi 1.6 not available, skipping input tests])
> >> +elif [test "x$have_xorg_gtest_evemu" != xyes]; then
> >> +    AC_MSG_NOTICE([uTouch-Evemu not available, skipping input tests])
> >> +else
> >> +    enable_input_tests=yes
> >> +fi
> >> +AM_CONDITIONAL(ENABLE_XORG_GTEST_INPUT_TESTS, [test "x$enable_input_tests" = xyes])
> >> +
> >>  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
> >> diff --git a/test/integration/.gitignore b/test/integration/.gitignore
> >> new file mode 100644
> >> index 0000000..ab86ebf
> >> --- /dev/null
> >> +++ b/test/integration/.gitignore
> >> @@ -0,0 +1 @@
> >> +gtest-tests
> >> diff --git a/test/integration/Makefile.am b/test/integration/Makefile.am
> >> index e70d642..3b7c858 100644
> >> --- a/test/integration/Makefile.am
> >> +++ b/test/integration/Makefile.am
> >> @@ -1,4 +1,28 @@
> >> +TESTS =
> >> +
> >>  if ENABLE_XORG_GTEST_TESTS
> >>  include $(top_srcdir)/test/integration/Makefile-xorg-gtest.am
> >>  check_LIBRARIES = $(XORG_GTEST_BUILD_LIBS)
> >> +
> >> +if ENABLE_XORG_GTEST_INPUT_TESTS
> >> +TESTS += gtest-tests
> >>  endif
> >> +endif
> >> +
> >> +check_PROGRAMS = $(TESTS)
> > 
> > noinst_PROGRAMS is better here.
> 
> Ok.
> 
> >> +
> >> +AM_CPPFLAGS = \
> >> +	-DDEFAULT_XORG_SERVER=\"$(abs_top_builddir)/hw/xfree86/Xorg\" \
> >> +	-DTEST_ROOT_DIR=\"$(abs_top_srcdir)/test/integration/\" \
> >> +	$(GTEST_CPPFLAGS) \
> >> +	$(XORG_GTEST_CPPFLAGS)
> >> +
> >> +AM_CXXFLAGS = $(GTEST_CXXFLAGS) $(XORG_GTEST_CXXFLAGS)
> >> +
> >> +gtest_tests_SOURCES = xi2.cpp
> >> +gtest_tests_LDADD = \
> >> +	$(TEST_XINPUT_LIBS) \
> >> +	$(TEST_X11_LIBS) \
> >> +	$(XORG_GTEST_LIBS) \
> >> +	$(EVEMU_LIBS) \
> >> +	$(XORG_GTEST_MAIN_LIBS)
> >> diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
> >> new file mode 100644
> >> index 0000000..68974a9
> >> --- /dev/null
> >> +++ b/test/integration/xi2.cpp
> >> @@ -0,0 +1,194 @@
> >> +#include <stdexcept>
> >> +
> >> +#include <xorg/gtest/xorg-gtest.h>
> >> +
> >> +#include <X11/extensions/XInput2.h>
> >> +
> >> +namespace {
> >> +
> >> +/**
> >> + * Wait for an event on the X connection.
> >> + *
> >> + * param [in] display The X display connection
> >> + * param [in] timeout The timeout in milliseconds
> > 
> > shouldn't these be @param?
> 
> Yep, thanks for catching it.
> 
> > Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net> otherwise
> > 
> > one question that remains though: my impression was that xorg-gtests would
> > go into the xorg-gtest repo but these are for the xserver repo. What's the
> > plan here?
> 
> These tests are testing the X server itself. I believe that having the
> tests in the upstream project repo ensures they are more likely to be
> run during development. I don't really see a reason for why they should
> live somewhere else.

fair enough, but what tests would then go into the xorg-gtest repo?

Cheers,
  Peter

> > wait_for_event on a Display* seems generic enough that I don't quite
> > understand why this isn't part of the xorg-gtest repo.
> 
> It likely will migrate there. However, I'm not 100% confident of its
> structure yet, so I don't want to commit to it in the xorg-gtest API/ABI
> quite yet. I would like to see more tests written using it first.



More information about the xorg-devel mailing list