commit:     4a6e82ab8fdfe2c9c7c2b0398a7c429c56534552
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 08:59:55 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 09:01:48 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a6e82ab

x11-misc/synergy: Reenable tests in 1.9.1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 x11-misc/synergy/files/synergy-1.9.1-gtest.patch   | 28 ------------------
 .../files/synergy-1.9.1-internal-gmock-gtest.patch | 23 ---------------
 x11-misc/synergy/files/synergy-1.9.1-test.patch    | 33 ++++++++++++++++++++++
 ...ynergy-1.9.1.ebuild => synergy-1.9.1-r1.ebuild} | 32 +++++++++++++++++----
 4 files changed, 60 insertions(+), 56 deletions(-)

diff --git a/x11-misc/synergy/files/synergy-1.9.1-gtest.patch 
b/x11-misc/synergy/files/synergy-1.9.1-gtest.patch
deleted file mode 100644
index f7a5e614e81..00000000000
--- a/x11-misc/synergy/files/synergy-1.9.1-gtest.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/src/lib/synergy/KeyMap.h
-+++ b/src/lib/synergy/KeyMap.h
-@@ -24,7 +24,9 @@
- #include "common/stdset.h"
- #include "common/stdvector.h"
- 
-+#if WITH_GENTOO_TEST
- #include <gtest/gtest_prod.h>
-+#endif
- 
- namespace synergy {
- 
-@@ -327,6 +329,7 @@
-     //@}
- 
- 
-+#if WITH_GENTOO_TEST
- private:
-     FRIEND_TEST(KeyMapTests,
-                 findBestKey_requiredDown_matchExactFirstItem);
-@@ -341,6 +344,7 @@
-     FRIEND_TEST(KeyMapTests,
-                 findBestKey_onlyOneRequiredDown_matchTwoRequiredChangesItem);
-     FRIEND_TEST(KeyMapTests, findBestKey_noRequiredDown_cannotMatch);
-+#endif
- 
- private:
-     //! Ways to synthesize a key

diff --git a/x11-misc/synergy/files/synergy-1.9.1-internal-gmock-gtest.patch 
b/x11-misc/synergy/files/synergy-1.9.1-internal-gmock-gtest.patch
deleted file mode 100644
index bc8a9613057..00000000000
--- a/x11-misc/synergy/files/synergy-1.9.1-internal-gmock-gtest.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/src/test/CMakeLists.txt
-+++ b/src/test/CMakeLists.txt
-@@ -14,20 +14,5 @@
- # You should have received a copy of the GNU General Public License
- # along with this program.  If not, see <http://www.gnu.org/licenses/>.
- 
--include_directories(
--    ../../ext/gtest
--    ../../ext/gtest/include
--    ../../ext/gmock
--    ../../ext/gmock/include)
--    
--add_library(gtest STATIC ../../ext/gtest/src/gtest-all.cc)
--add_library(gmock STATIC ../../ext/gmock/src/gmock-all.cc)
--
--if (UNIX)
--    # ignore warnings in gtest and gmock
--    set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w")
--    set_target_properties(gmock PROPERTIES COMPILE_FLAGS "-w")
--endif()
--
- add_subdirectory(integtests)
- add_subdirectory(unittests)

diff --git a/x11-misc/synergy/files/synergy-1.9.1-test.patch 
b/x11-misc/synergy/files/synergy-1.9.1-test.patch
new file mode 100644
index 00000000000..d0c44e9dd7f
--- /dev/null
+++ b/x11-misc/synergy/files/synergy-1.9.1-test.patch
@@ -0,0 +1,33 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index ab63a06..ec7a3e0 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -22,3 +22,8 @@ add_subdirectory(cmd)
+ if (SYNERGY_BUILD_LEGACY_GUI)
+ add_subdirectory(gui)
+ endif (SYNERGY_BUILD_LEGACY_GUI)
++
++option(BUILD_TESTS "Build tests" OFF)
++if (BUILD_TESTS)
++      add_subdirectory(test)
++endif()
+diff --git a/src/test/integtests/CMakeLists.txt 
b/src/test/integtests/CMakeLists.txt
+index f39968a..bfc886c 100644
+--- a/src/test/integtests/CMakeLists.txt
++++ b/src/test/integtests/CMakeLists.txt
+@@ -68,4 +68,4 @@ endif()
+ 
+ add_executable(integtests ${sources})
+ target_link_libraries(integtests
+-    arch base client common io ipc mt net platform server synergy gtest gmock 
${libs} ${OPENSSL_LIBS})
++    arch base client common io ipc mt net platform server gtest gmock ${libs} 
${OPENSSL_LIBS})
+diff --git a/src/test/unittests/CMakeLists.txt 
b/src/test/unittests/CMakeLists.txt
+index 54131eb..ef84dba 100644
+--- a/src/test/unittests/CMakeLists.txt
++++ b/src/test/unittests/CMakeLists.txt
+@@ -68,4 +68,4 @@ endif()
+ 
+ add_executable(unittests ${sources})
+ target_link_libraries(unittests
+-    arch base client server common io net platform server synergy mt ipc 
gtest gmock shared ${libs} ${OPENSSL_LIBS})
++    arch base client server common io net platform server mt ipc gtest gmock 
shared ${libs} ${OPENSSL_LIBS})

diff --git a/x11-misc/synergy/synergy-1.9.1.ebuild 
b/x11-misc/synergy/synergy-1.9.1-r1.ebuild
similarity index 76%
rename from x11-misc/synergy/synergy-1.9.1.ebuild
rename to x11-misc/synergy/synergy-1.9.1-r1.ebuild
index 0c5c3b75592..021b8d2d54b 100644
--- a/x11-misc/synergy/synergy-1.9.1.ebuild
+++ b/x11-misc/synergy/synergy-1.9.1-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit cmake-utils desktop gnome2-utils
+inherit cmake-utils desktop gnome2-utils virtualx
 
 DESCRIPTION="Lets you easily share a single mouse and keyboard between 
multiple computers"
 HOMEPAGE="https://symless.com/synergy https://github.com/symless/synergy-core";
@@ -15,8 +15,8 @@ SRC_URI="
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux 
~x86-macos ~sparc-solaris ~x86-solaris"
-IUSE="libressl qt5"
-RESTRICT="test"
+IUSE="libressl qt5 test"
+RESTRICT="!test? ( test )"
 
 S=${WORKDIR}/${PN}-core-${PV}-stable
 
@@ -53,21 +53,43 @@ DOCS=( ChangeLog 
doc/synergy.conf.example{,-advanced,-basic} )
 
 PATCHES=(
        "${FILESDIR}"/${P}-pthread.patch
-       "${FILESDIR}"/${P}-internal-gmock-gtest.patch
-       "${FILESDIR}"/${P}-gtest.patch
        "${FILESDIR}"/${P}-cmake-version.patch
        "${FILESDIR}"/${P}-qt-5.11.patch
+       "${FILESDIR}"/${P}-test.patch
 )
 
+src_prepare() {
+       # requires Internet, and relies on old site anyway
+       rm src/test/integtests/arch/ArchInternetTests.cpp || die
+       # broken on Xvfb
+       rm src/test/integtests/platform/XWindowsScreenTests.cpp || die
+
+       cmake-utils_src_prepare
+}
+
 src_configure() {
+       # otherwise unit tests segfault
+       local -x CFLAGS="${CFLAGS} -O0"
+       local -x CXXFLAGS="${CXXFLAGS} -O0"
+
        local mycmakeargs=(
                -DSYNERGY_BUILD_LEGACY_GUI=$(usex qt5)
                -DSYNERGY_BUILD_LEGACY_INSTALLER=OFF
+               -DBUILD_TESTS=$(usex test)
        )
 
        cmake-utils_src_configure
 }
 
+my_test() {
+       "${BUILD_DIR}"/bin/unittests &&
+       "${BUILD_DIR}"/bin/integtests
+}
+
+src_test() {
+       virtx my_test
+}
+
 src_install() {
        dobin "${BUILD_DIR}"/bin/{synergy{c,s},syntool}
 

Reply via email to