.gitignore | 79 ++++ COPYING | 693 +------------------------------------- Makefile.am | 35 + README | 72 +++ aclocal/Makefile.am | 27 + aclocal/xorg-gtest.m4 | 110 ++++++ conf/dummy.conf | 4 configure.ac | 81 +++- data/Makefile.am | 26 + data/xorg/gtest/dummy.conf | 4 debian/README.Debian | 4 debian/changelog | 8 debian/control | 28 - debian/libxorg-gtest-dev.install | 6 debian/libxorg-gtest0.install | 2 debian/libxorg-gtest0.symbols | 45 -- debian/rules | 6 doc/Makefile.am | 46 +- examples/Makefile.am | 70 ++- examples/xorg-gtest-example.cpp | 18 examples/xorg-gtest.cpp | 18 include/Makefile.am | 31 + include/xorg/gtest/environment.h | 33 + include/xorg/gtest/evemu/device.h | 91 ++++ include/xorg/gtest/process.h | 35 + include/xorg/gtest/test.h | 32 + include/xorg/gtest/xorg-gtest.h | 34 + m4/gtest.m4 | 71 +++ src/Makefile-xorg-gtest.am | 61 +++ src/Makefile.am | 69 +-- src/defines.h | 6 src/device.cpp | 94 +++++ src/environment.cpp | 56 +-- src/libxorg-gtest.ver | 15 src/libxorg-gtest_main.ver | 7 src/main.cpp | 125 ------ src/process.cpp | 32 + src/test.cpp | 32 + src/xorg-gtest-all.cpp | 34 + src/xorg-gtest_main.cpp | 131 +++++++ xorg-gtest.pc.in | 6 41 files changed, 1247 insertions(+), 1130 deletions(-)
New commits: commit 43469e772c7152059d651461e501422119e57295 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:39:10 2012 -0700 releasing version 0.2.0-0ubuntu1 diff --git a/debian/changelog b/debian/changelog index d226c3b..1aad762 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -xorg-gtest (0.2.0-0ubuntu1) UNRELEASED; urgency=low +xorg-gtest (0.2.0-0ubuntu1) precise; urgency=low * Update to xorg-gtest 0.2.0 - Remove precompiled libraries and - Update for source-only distribution (LP: #959836) - -- Chase Douglas <chase.doug...@ubuntu.com> Mon, 19 Mar 2012 18:05:40 -0700 + -- Chase Douglas <chase.doug...@ubuntu.com> Mon, 19 Mar 2012 18:39:04 -0700 xorg-gtest (0.1.1-0ubuntu2) precise; urgency=low commit 613632a287a78aaf730b38c35e9e483695d61f60 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:38:42 2012 -0700 Bump lintian standards version to 3.9.3 diff --git a/debian/control b/debian/control index 0b0d99d..6af5bdb 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends: automake, xserver-xorg-dev, xserver-xorg-video-dummy, xutils-dev (>= 1:7.7~1) -Standards-Version: 3.9.2 +Standards-Version: 3.9.3 Section: libs Vcs-Git: git://anongit.freedesktop.org/~cndougla/xorg-gtest Vcs-Browser: http://cgit.freedesktop.org/~cndougla/xorg-gtest commit 7e63e88cd7c7eb07b158ca781441c1ed5d44042f Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:36:03 2012 -0700 Install xorg-gtest.pc in architecture-independent directory /usr/lib/pkgconfig diff --git a/debian/rules b/debian/rules index 42e50ab..dbc39af 100755 --- a/debian/rules +++ b/debian/rules @@ -6,6 +6,10 @@ %: dh $@ --parallel --with quilt,autoreconf +# Install xorg-gtest.pc file in architecture independent directory +override_dh_auto_configure: + dh_auto_configure -- --libdir=/usr/lib + override_dh_auto_build: dh_auto_build -- all doc commit f8d800534d48076e8cc64eca208fc5d4cd5f8aa7 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:33:47 2012 -0700 Remove Multi-Arch specification for libxorg-gtest-data It's not needed any more since libxorg-gtest-dev is arch: all. diff --git a/debian/control b/debian/control index 1f268b0..0b0d99d 100644 --- a/debian/control +++ b/debian/control @@ -32,7 +32,6 @@ Description: X.Org dummy testing environment for Google Test - headers Package: libxorg-gtest-data Section: devel Architecture: all -Multi-Arch: foreign Depends: ${misc:Depends} Description: X.Org dummy testing environment for Google Test - data Provides a Google Test environment for starting and stopping commit a88e2df9ce67641d54682dc1d0653037686d89d9 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:14:05 2012 -0700 Change libxorg-gtest-dev from arch: any to all It no longer provides any binaries, only source code. diff --git a/debian/control b/debian/control index 96c6c08..1f268b0 100644 --- a/debian/control +++ b/debian/control @@ -21,7 +21,7 @@ Vcs-Browser: http://cgit.freedesktop.org/~cndougla/xorg-gtest Package: libxorg-gtest-dev Section: libdevel -Architecture: any +Architecture: all Depends: libgtest-dev, libxorg-gtest-data (= ${source:Version}), ${misc:Depends} Description: X.Org dummy testing environment for Google Test - headers Provides a Google Test environment for starting and stopping commit 7f5409bbe7ac68766f27424632a6a2b413c17624 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 18:07:14 2012 -0700 Update to xorg-gtest 0.2.0 * Update to xorg-gtest 0.2.0 - Remove precompiled libraries and - Update for source-only distribution (LP: #959836) diff --git a/debian/changelog b/debian/changelog index 2d0dd98..d226c3b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +xorg-gtest (0.2.0-0ubuntu1) UNRELEASED; urgency=low + + * Update to xorg-gtest 0.2.0 + - Remove precompiled libraries and + - Update for source-only distribution (LP: #959836) + + -- Chase Douglas <chase.doug...@ubuntu.com> Mon, 19 Mar 2012 18:05:40 -0700 + xorg-gtest (0.1.1-0ubuntu2) precise; urgency=low * Really fix per-arch symbol for amd64 and powerpc commit c31c47b43a4894232940f73cd24c71410080b594 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 17:44:49 2012 -0700 Update to version 0.2.0 diff --git a/debian/changelog b/debian/changelog index c131903..89ddd84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -xorg-gtest (0.1.1-1) UNRELEASED; urgency=low +xorg-gtest (0.2.0-1) UNRELEASED; urgency=low [ Daniel d'Andrada ] * Initial release [ Chase Douglas ] - * Update to xorg-gtest-0.1.1 + * Update to xorg-gtest-0.2.0 - -- Chase Douglas <chase.doug...@ubuntu.com> Wed, 15 Feb 2012 08:55:27 -0800 + -- Chase Douglas <chase.doug...@ubuntu.com> Mon, 19 Mar 2012 17:29:10 -0700 commit 8a1d6da05c76accd5ea38bb7883da44042abb710 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 17:44:10 2012 -0700 Switch to source distribution instead of precompiled library distribution diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index e7f81b1..0000000 --- a/debian/README.Debian +++ /dev/null @@ -1,4 +0,0 @@ -Google ships google-test as a static library only. This is found in -libgtest-dev. The xorg-gtest library links against it, but does not allow -visibility of the gtest library symbols. Users of xorg-gtest must still link -against gtest, so libxorg-gtest0 depends on libgtest-dev. diff --git a/debian/control b/debian/control index 6bfd647..96c6c08 100644 --- a/debian/control +++ b/debian/control @@ -22,26 +22,12 @@ Vcs-Browser: http://cgit.freedesktop.org/~cndougla/xorg-gtest Package: libxorg-gtest-dev Section: libdevel Architecture: any -Depends: libxorg-gtest0 (= ${binary:Version}), ${misc:Depends} +Depends: libgtest-dev, libxorg-gtest-data (= ${source:Version}), ${misc:Depends} Description: X.Org dummy testing environment for Google Test - headers Provides a Google Test environment for starting and stopping a dummy X server for headless testing purposes. . - This package provides the necessary header files - -Package: libxorg-gtest0 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: libgtest-dev, - libxorg-gtest-data (= ${source:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Recommends: xserver-xorg-video-dummy -Description: X.Org dummy testing environment for Google Test - Provides a Google Test environment for starting and stopping - a dummy X server for headless testing purposes. + This package provides the source code and header files for xorg-gtest. Package: libxorg-gtest-data Section: devel diff --git a/debian/libxorg-gtest-dev.install b/debian/libxorg-gtest-dev.install index c4c281b..a37d50f 100644 --- a/debian/libxorg-gtest-dev.install +++ b/debian/libxorg-gtest-dev.install @@ -1,4 +1,4 @@ usr/include -usr/lib/*/libxorg-gtest.so -usr/lib/*/libxorg-gtest_main.so -usr/lib/*/pkgconfig +usr/lib +usr/share/aclocal +usr/src diff --git a/debian/libxorg-gtest0.install b/debian/libxorg-gtest0.install deleted file mode 100644 index 68e7c55..0000000 --- a/debian/libxorg-gtest0.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/*/libxorg-gtest.so.0* -usr/lib/*/libxorg-gtest_main.so.0* diff --git a/debian/libxorg-gtest0.symbols b/debian/libxorg-gtest0.symbols deleted file mode 100644 index 90b2136..0000000 --- a/debian/libxorg-gtest0.symbols +++ /dev/null @@ -1,45 +0,0 @@ -libxorg-gtest.so.0 libxorg-gtest0 #MINVER# - XORG_GTEST_1.0@XORG_GTEST_1.0 0.1.0 - (c++)"xorg::testing::Environment::set_server(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::set_display(int)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::set_log_file(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::set_conf_file(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::SetUp()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::TearDown()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::Environment()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::Environment()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::~Environment()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::~Environment()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::~Environment()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::SetUp()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::TearDown()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::Test()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::Test()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::~Test()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::~Test()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::~Test()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Kill()@XORG_GTEST_1.0" 0.1.0 - (c++|arch=amd64 powerpc)"xorg::testing::Process::Start(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, __va_list_tag*)@XORG_GTEST_1.0" 0.1.0 - (c++|arch=armel armhf)"xorg::testing::Process::Start(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__va_list)@XORG_GTEST_1.0" 0.1.0 - (c++|arch=i386)"xorg::testing::Process::Start(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char*)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Start(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ...)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::GetEnv(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool*)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::SetEnv(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Terminate()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Process()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Process()@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::server() const@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::display() const@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::log_file() const@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Environment::conf_file() const@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Test::Display() const@XORG_GTEST_1.0" 0.1.0 - (c++)"xorg::testing::Process::Pid() const@XORG_GTEST_1.0" 0.1.0 - (c++)"typeinfo for xorg::testing::Environment@XORG_GTEST_1.0" 0.1.0 - (c++)"typeinfo for xorg::testing::Test@XORG_GTEST_1.0" 0.1.0 - (c++)"typeinfo name for xorg::testing::Environment@XORG_GTEST_1.0" 0.1.0 - (c++)"typeinfo name for xorg::testing::Test@XORG_GTEST_1.0" 0.1.0 - (c++)"vtable for xorg::testing::Environment@XORG_GTEST_1.0" 0.1.0 - (c++)"vtable for xorg::testing::Test@XORG_GTEST_1.0" 0.1.0 -libxorg-gtest_main.so.0 libxorg-gtest0 #MINVER# - XORG_GTEST_1.0@XORG_GTEST_1.0 0.1.0 - main@XORG_GTEST_1.0 0.1.0 diff --git a/debian/rules b/debian/rules index 019d49a..42e50ab 100755 --- a/debian/rules +++ b/debian/rules @@ -10,4 +10,4 @@ override_dh_auto_build: dh_auto_build -- all doc override_dh_install: - dh_install --fail-missing -X.la -X.a + dh_install --fail-missing commit 4c067c740f4e7eb5b8f46b92f2e046f77f40b1b3 Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 17:33:47 2012 -0700 Add build depends on xserver-xorg-core and xserver-xorg-video-dummy for testing diff --git a/debian/control b/debian/control index 9d17da3..6bfd647 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,9 @@ Build-Depends: automake, libx11-dev, pkg-config, quilt, + xserver-xorg-core, xserver-xorg-dev, + xserver-xorg-video-dummy, xutils-dev (>= 1:7.7~1) Standards-Version: 3.9.2 Section: libs commit 676424853d798af1a37df05fe302b55d7eb7405d Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 17:32:41 2012 -0700 Add build depends on xutils-dev >= 7.7~1 for xorg-macros 1.17.0 diff --git a/debian/control b/debian/control index 1756a8a..9d17da3 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,8 @@ Build-Depends: automake, libx11-dev, pkg-config, quilt, - xserver-xorg-dev + xserver-xorg-dev, + xutils-dev (>= 1:7.7~1) Standards-Version: 3.9.2 Section: libs Vcs-Git: git://anongit.freedesktop.org/~cndougla/xorg-gtest commit ad440d9c228a44981f1e2364fb0678840b08be3c Author: Chase Douglas <chase.doug...@canonical.com> Date: Mon Mar 19 17:00:45 2012 -0700 Release version 0.2.0 Signed-off-by: Chase Douglas <chase.doug...@canonical.com> diff --git a/configure.ac b/configure.ac index 2d70801..f3dd610 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([Dummy X.org Testing Environment for Google Test], - [0.1.1], + [0.2.0], [], [xorg-gtest]) AC_CONFIG_SRCDIR([Makefile.am]) commit 852b504288ca579a06b741b4588ee1b98b1b45f5 Author: Chase Douglas <chase.doug...@canonical.com> Date: Thu Mar 8 14:51:40 2012 -0800 Ship xorg-gtest.m4 and Makefile-xorg-gtest.am See README for instructions on how to use them. Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rog...@canonical.com> diff --git a/Makefile.am b/Makefile.am index 2542b44..8e0a0c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ # SOFTWARE. # -SUBDIRS = data doc include src examples +SUBDIRS = aclocal data doc include src examples pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xorg-gtest.pc diff --git a/README b/README index 6b79f05..7a44075 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -X.Org dummy testing environment for Google Test +X.Org GTest testing environment for Google Test =============================================== Provides a Google Test environment for starting and stopping @@ -7,6 +7,70 @@ environment is defined in header environment.h. Please refer to the Google test documentation for information on how to add a custom environment. -Moreover, a custom main()-function that takes care of setting up the -environment is provided in libxtestingenvironment_main.a. This library can be -used as a replacement for libgtest_main.a +Moreover, a custom main() function that takes care of setting up the +environment is provided in xorg-gtest_main.cpp. This can be used as a +replacement for libgtest_main.a + +Using X.org GTest in a project +============================== + +The X.org GTest does not provide precompiled libraries. Each project must build +the X.org GTest sources. To facilitate this, aclocal and automake include files +are provided. Perform the following to integrate xorg-gtest into an autotools- +based project. + +Add the following line to the top level Makefile.am for your project: + +ACLOCAL_AMFLAGS = -I m4 --install + +This will ensure the latest xorg-gtest.m4 macro installed on your system is +copied into aclocal/. If a user runs autoreconf, they will already have the +macro even if they don't have xorg-gtest installed. + +Call CHECK_XORG_GTEST from configure.ac This will set the value of +$have_xorg_gtest and set $(XORG_GTEST_CPPFLAGS) and $(XORG_GTEST_CXXFLAGS). + +The last step is to modify your test automake rules for compiling and using +xorg-gtest. There are two methods to do this: simplified or manual. + +Simplified +---------- + +This method requires less changes to your Makefile.am, but has a few drawbacks: + +* xorg-gtest is compiled only once. If you need multiple versions of xorg-gtest + or gtest compiled with different flags, you will need to use the manual + method. +* The flags used to compile xorg-gtest must be the same as the flags used to + compile the tests. This means any flags other than XORG_GTEST_CPPFLAGS and + XORG_GTEST_CXXFLAGS must be provided through the AM_CPPFLAGS and AM_CXXFLAGS + variables. + +Copy Makefile-xorg-gtest.am into your project. + +In your test Makefile.am, add: + +include $(top_srcdir)/path/to/Makefile-xorg-gtest.am + +Append $(XORG_GTEST_BUILD_LIBS) to check_LIBRARIES. + +Append CPPFLAGS with $(XORG_GTEST_CPPFLAGS) and CXXFLAGS with +$(XORG_GTEST_CXXFLAGS) for any testing source objects. + +Finally, link against $(XORG_GTEST_LIBS). If you want the xorg-gtest main() +integration, link against $(XORG_GTEST_MAIN_LIBS) as well. + +Manual +------ + +This method is more flexible, but it requires the user to modify the Makefile.am +file manually. It is recommended that the user be familiar with automake before +attempting. + +Copy the contents of Makefile-xorg-gtest.am into your Makefile.am file. Adjust +the compilation flags as needed, keeping in mind that all non-warning flags must +match the flags used when compiling the test cases. Remove the gtest and/or +xorg-gtest main() library targets if you will not use them. Copy the gtest and +xorg-gtest library targets if multiple builds with different compilation flags +are needed. Finally, link the tests with the appropriate gtest and xorg-gtest +libraries and their dependencies: libpthread and libX11. diff --git a/aclocal/Makefile.am b/aclocal/Makefile.am new file mode 100644 index 0000000..3ea9969 --- /dev/null +++ b/aclocal/Makefile.am @@ -0,0 +1,27 @@ +# +# Makefile for the src subdirectory of xorg-gtest +# +# 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. +# + +aclocaldir = $(datadir)/aclocal +dist_aclocal_DATA = xorg-gtest.m4 diff --git a/aclocal/xorg-gtest.m4 b/aclocal/xorg-gtest.m4 new file mode 100644 index 0000000..52dd5aa --- /dev/null +++ b/aclocal/xorg-gtest.m4 @@ -0,0 +1,110 @@ +# serial 1 + +# 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_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/configure.ac b/configure.ac index 37a6dc0..2d70801 100644 --- a/configure.ac +++ b/configure.ac @@ -74,6 +74,7 @@ AS_IF([test "x$enable_integration_tests" = xyes -a \ AM_CONDITIONAL(ENABLE_XORG_GTEST_TESTS, [test "x$have_dummy_module" = xyes ]) AC_CONFIG_FILES([Makefile + aclocal/Makefile data/Makefile doc/Makefile examples/Makefile diff --git a/src/Makefile-xorg-gtest.am b/src/Makefile-xorg-gtest.am new file mode 100644 index 0000000..185381d --- /dev/null +++ b/src/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 +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/src/Makefile.am b/src/Makefile.am index c5a8413..148f1f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,4 +35,7 @@ libxorg_gtest_main_sources = \ xorg-gtest_main.cpp srcinstalldir = $(prefix)/src/xorg-gtest/src -dist_srcinstall_DATA = $(libxorg_gtest_sources) $(libxorg_gtest_main_sources) +dist_srcinstall_DATA = \ + Makefile-xorg-gtest.am \ + $(libxorg_gtest_sources) \ + $(libxorg_gtest_main_sources) commit 3f019e8272e33869312a7b5a94af94e14c81cd15 Author: Chase Douglas <chase.doug...@canonical.com> Date: Tue Mar 13 23:30:39 2012 -0700 Print more helpful error message when X server fails to start Usually, xorg-gtest requires the dummy video driver. It also requires an X server at least version 1.12, or to be run as root when testing with a previous X server. Print this information when the server fails to start, and point the user to the log file for further details. Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Reviewed-By: Christopher Halse Rogers <christopher.halse.rog...@canonical.com> diff --git a/src/environment.cpp b/src/environment.cpp index 3da27cb..f4bb9e1 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -122,16 +122,22 @@ void xorg::testing::Environment::SetUp() { int status; int pid = waitpid(d_->process.Pid(), &status, WNOHANG); - if (pid == d_->process.Pid()) - throw std::runtime_error("Dummy X server failed to start, did you run as " - "root?"); - else if (pid == 0) + if (pid == d_->process.Pid()) { + std::string message; + message += "X server failed to start. Ensure that the \"dummy\" video " + "driver is installed. If the X.org server is older than 1.12, " + "tests will need to be run as root. Check "; + message += d_->path_to_log_file; + message += " for any errors"; + throw std::runtime_error(message); + } else if (pid == 0) { sleep(1); /* Give the dummy X server some time to start */ - else if (pid == -1) + } else if (pid == -1) { throw std::runtime_error("Could not get status of dummy X server " "process"); - else + } else { throw std::runtime_error("Invalid child PID returned by Process::Wait()"); + } } throw std::runtime_error("Unable to open connection to dummy X server"); commit 6d0cd228d5ea5ff734f3bc1754d0dfbb93e6d1b4 Author: Chase Douglas <chase.doug...@canonical.com> Date: Tue Mar 13 11:32:02 2012 -0700 Allow user to override default Xorg server binary This can be accomplished by compiling xorg-gtest with -DDEFAULT_XORG_SERVER=path/to/Xorg. Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Reviewed-By: Christopher Halse Rogers <christopher.halse.rog...@canonical.com> diff --git a/src/defines.h b/src/defines.h index 3bfc1da..3fb3304 100644 --- a/src/defines.h +++ b/src/defines.h @@ -2,7 +2,11 @@ #define XORGGTEST_DEFINES #define DEFAULT_XORG_LOGFILE "/tmp/Xorg.GTest.log" -#define DEFAULT_XORG_SERVER "Xorg" #define DEFAULT_DISPLAY 133 +/* Allow user to override default Xorg server*/ +#ifndef DEFAULT_XORG_SERVER +#define DEFAULT_XORG_SERVER "Xorg" +#endif + #endif commit 4acb16f939c73dc081775e29eb4089e4184fffbf Author: Chase Douglas <chase.doug...@canonical.com> Date: Thu Mar 8 14:24:16 2012 -0800 Install, but do not build into a library, the xorg-gtest sources This mimics the Google Test distribution mechanism. See: http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Reviewed-By: Christopher Halse Rogers <christopher.halse.rog...@canonical.com> diff --git a/configure.ac b/configure.ac index 40a97f1..37a6dc0 100644 --- a/configure.ac +++ b/configure.ac @@ -11,13 +11,6 @@ AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE([enable]) -LIB_VERSION=0:0:0 -AC_SUBST([LIB_VERSION]) - -# Initialize libtool -AC_PROG_LIBTOOL - - # Checks for programs. AC_PROG_CXX AC_PROG_RANLIB @@ -55,6 +48,9 @@ AS_IF([test "x$with_evemu" == xyes], AM_CONDITIONAL([HAVE_EVEMU], [test "x$have_evemu" = "xyes"]) AS_IF([test "x$have_evemu" = xyes], [AC_DEFINE([HAVE_EVEMU])]) +AC_SUBST(SOURCEDIR, ['${prefix}/src/xorg-gtest']) +AC_SUBST(DUMMY_CONF_PATH, ['${datarootdir}/xorg/gtest/dummy.conf']) + # Check if we can build integration tests AS_IF([test "x$enable_integration_tests" != xno], [AC_MSG_CHECKING([for X.org server])] diff --git a/src/Makefile.am b/src/Makefile.am index e12e772..c5a8413 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,39 +23,16 @@ # SOFTWARE. # -lib_LTLIBRARIES = libxorg-gtest.la libxorg-gtest_main.la - -AM_CXXFLAGS = -I$(top_srcdir)/include $(XSERVER_CFLAGS) $(BASE_CXXFLAGS) - -libxorg_gtest_la_SOURCES = xorg-gtest-all.cpp - -libxorg_gtest_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(GTEST_CPPFLAGS) \ - -DDUMMY_CONF_PATH="\"$(datadir)/xorg/gtest/dummy.conf\"" - -libxorg_gtest_main_la_SOURCES = \ +libxorg_gtest_sources = \ + environment.cpp \ + device.cpp \ + process.cpp \ + test.cpp \ + xorg-gtest-all.cpp + +libxorg_gtest_main_sources = \ defines.h \ xorg-gtest_main.cpp -libxorg_gtest_main_la_LIBADD = libxorg-gtest.la - -libxorg_gtest_main_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(GTEST_CPPFLAGS) - -libxorg_gtest_la_LDFLAGS = $(XSERVER_LIBS) -Wl,--version-script=$(top_srcdir)/src/libxorg-gtest.ver -libxorg_gtest_main_la_LDFLAGS = \ - $(XSERVER_LIBS) \ - -Wl,--version-script=$(top_srcdir)/src/libxorg-gtest_main.ver - -if HAVE_EVEMU -libxorg_gtest_la_SOURCES += device.cpp - -libxorg_gtest_la_LIBADD = $(EVEMU_LIBS) -endif - srcinstalldir = $(prefix)/src/xorg-gtest/src -dist_srcinstall_DATA = $(libxorg_gtest_la_SOURCES) $(libxorg_gtest_main_la_SOURCES) - -EXTRA_DIST = libxorg-gtest.ver libxorg-gtest_main.ver +dist_srcinstall_DATA = $(libxorg_gtest_sources) $(libxorg_gtest_main_sources) diff --git a/src/libxorg-gtest.ver b/src/libxorg-gtest.ver deleted file mode 100644 index c617446..0000000 --- a/src/libxorg-gtest.ver +++ /dev/null @@ -1,24 +0,0 @@ -XORG_GTEST_1.0 { - global: - extern "C++" { - xorg::testing::Environment::*; - xorg::testing::Process::*; - xorg::testing::Test::*; - "typeinfo for xorg::testing::Environment"; - "typeinfo for xorg::testing::Test"; - "typeinfo name for xorg::testing::Environment"; - "typeinfo name for xorg::testing::Test"; - "vtable for xorg::testing::Environment"; - "vtable for xorg::testing::Test"; - }; - - local: - *; -}; - -XORG_GTEST_1.1 { - global: - extern "C++" { - xorg::testing::evemu::*; - }; -} XORG_GTEST_1.0; diff --git a/src/libxorg-gtest_main.ver b/src/libxorg-gtest_main.ver deleted file mode 100644 index 001ce91..0000000 --- a/src/libxorg-gtest_main.ver +++ /dev/null @@ -1,7 +0,0 @@ -XORG_GTEST_1.0 { - global: - main; - - local: - *; -}; diff --git a/xorg-gtest.pc.in b/xorg-gtest.pc.in index 7df6fbf..a80f666 100644 --- a/xorg-gtest.pc.in +++ b/xorg-gtest.pc.in @@ -1,11 +1,9 @@ prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ includedir=@includedir@ +sourcedir=@SOURCEDIR@ datarootdir=@datarootdir@ +CPPflags=-I${includedir} -I${sourcedir} -DDUMMY_CONF_PATH=\"@DUMMY_CONF_PATH@\" Name: xorg-gtest Description: X.org Google Test Environment Version: @PACKAGE_VERSION@ -Cflags: -I${includedir} -DDUMMY_CONF_PATH=@DUMMY_CONF_PATH@ -Libs: -L${libdir} -lxorg-gtest commit 71f006cadac2bc7f249965896d898143d7592f12 Author: Chase Douglas <chase.doug...@canonical.com> Date: Thu Mar 8 14:18:39 2012 -0800 Build gtest as part of the project Google Test does not recommend using precompiled gtest libraries. See: http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog This change modifies the build system so the examples build the gtest and xorg-gtest libraries and link against the locally built libraries instead of any other precompiled libraries on the system. It uses the same compiler flags to compile everything so the C++ One-Definition Rule is not broken. Signed-off-by: Chase Douglas <chase.doug...@canonical.com> -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1s9o97-0002s9...@vasks.debian.org