diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-08-25 10:45:55 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-08-25 10:45:55 +0100 |
commit | 3cf7c3ef441822c889356fd1812ebf2944a59851 (patch) | |
tree | c513fe68548b40365c1c2ebfe35c58ad431cdd77 /x11-misc/barrier | |
parent | 05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff) |
gentoo resync : 25.08.2020
Diffstat (limited to 'x11-misc/barrier')
-rw-r--r-- | x11-misc/barrier/Manifest | 10 | ||||
-rw-r--r-- | x11-misc/barrier/barrier-2.3.3.ebuild (renamed from x11-misc/barrier/barrier-2.3.2-r1.ebuild) | 19 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch | 132 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch | 25 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.2-pthread.patch | 115 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.2-qt-gui-only.patch | 45 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.3-gtest.patch | 116 | ||||
-rw-r--r-- | x11-misc/barrier/files/barrier-2.3.3-tests.patch | 150 |
8 files changed, 283 insertions, 329 deletions
diff --git a/x11-misc/barrier/Manifest b/x11-misc/barrier/Manifest index c6e3a9ca9b32..6726ab72af7b 100644 --- a/x11-misc/barrier/Manifest +++ b/x11-misc/barrier/Manifest @@ -1,7 +1,5 @@ -AUX barrier-2.3.2-inf-loop.patch 4636 BLAKE2B 83df131ec2b17c2ab445d3848855497bc507cc9d3ae61101bd3f0f7eff848a8cba7ebeb0fdb8d3fb53e99027f808dd16e87a16edcd497ce447e95246d633c2c6 SHA512 9b5f36ecf2b2204692b3531927abad4a9fc01e1a134cbfde8e2f36ba326a2a4432e7fe13cafa7ebcdccee3284635885ae23fac2edeb96d2002ca535805aefe0f -AUX barrier-2.3.2-no-avahi.patch 864 BLAKE2B 343c5eb12fdf004140f28f8bad8c78183e7a15d3ca06eb7e378ad02dacb81be96de3b3651aaf7eed13ee94fcb84e08fd48b1c145fa2b70658d6febf168d00c1a SHA512 efa25e95d960f3dc1e8ec763dc4bde2fe7f5f6506c6f59d37f4cdaf36a30a5433e0a0b9d16d0f6fc86770a9cd50c8028add411db163290eed15b87416c4ee388 -AUX barrier-2.3.2-pthread.patch 4061 BLAKE2B 44900b4a675abd843240f63e5f74dedc2165f170c39d44d0490892a44a786a3d8c3f1e47b7661e879dbc82a5074c8fc9a3a3672ca5fdbe9f91861b62ab9a9753 SHA512 d9b1e92904bb0f7927dd6c09474ad9264a25f730d1e32c0cc68d0f28d155b56ce908a0908c07ef09040e28e22c9699b7b7605c284ee2cd6ddb01f56b457e1cf7 -AUX barrier-2.3.2-qt-gui-only.patch 1329 BLAKE2B 179bba5dfa392b786d181302f8bbd7f1e3293fdc3445566cdf824df1de1cfbc28f7c0b03f68f949a92de9b0f047d8d5bc45c58ec4c593c7d5f081bc6b61f208d SHA512 cf9a27da008fe03057ab091b17dc144a312fcfe65b692a520e023e56d34df3df2a9b9691fa64b426e54edaa6472ae4b1fdc7837818875f06e9e9b32ad6d883ce -DIST barrier-2.3.2.tar.gz 7244128 BLAKE2B 263be99ffb692e5b8e3e3450565fbaf5c5e2f23beca4beaf5d699547933be1bcdcbf1ed6b9ce8bd53f2a5dbb1eba3fc06490620555520fcff0e8d34ff2ad52cb SHA512 0452244afc3294aaafd89f18d2472e24fb2fc62426e7be91ab4ffceca4697c7acb8f4438fc299835f1312f0ada83911679abe6b8e1268631130c5877e193ff83 -EBUILD barrier-2.3.2-r1.ebuild 1464 BLAKE2B 9606b1dda451529711d441a7bf8fab21291f212be38e125f24adf4b66b4f57e4bdcf68db28a68e2a7d1a3b0396bbf1e5ea01276fd82487dd2f9584d2d1a06687 SHA512 ed96d398beb14f62af7455b067bc1b5aeba031b5676cfd028bd3f792146ee68dcce37f61a7205b784b511c7da254ebc1cfcaf99e3489a6d587e899bb2be10219 +AUX barrier-2.3.3-gtest.patch 3981 BLAKE2B f9a91a9b090ae4210d005db307d31930f7d2939f17e1c2bdbdbcd26b22743054f2d35c57c3e55ac6b6212e2d2274bcecad015c2afe8db909bfd4c030f976ae65 SHA512 82d78f658af279c8f2ec48cfa1dcec2cd6104d605b1157adeead73623fd0f7459141eb696619e71ea78ab1f7872369c78ef1ceeb9f90e7e7bed4b2a57aac5cca +AUX barrier-2.3.3-tests.patch 4951 BLAKE2B 66996d3d9297bf0b188350154a380e522a0ddade4b1693fb62be6acbd624f327527b281cc3611b25b3cae0d084dc6af0eaae0e8487696c4b2589f76382381a4f SHA512 dcde430f1c0e1a4d65a4ed6afad1501f4ec6e448d0a56eeeadb46732fb8149fc7e74b5245e583ca8d4552ecca75dd59cabb9ba4ad549c8fda55e2178ede1ffed +DIST barrier-2.3.3.tar.gz 5465909 BLAKE2B 3f881526f53113e48f1ea2e1592ebf2e932a8296fcba331243678963945001e7700dddc3bf8957f85285aec02c3d3700d31786cef291862a9b21780ee9e96cd6 SHA512 1ac945ce090d5bbdae7bab7d4ca802cc2d54c1644a12088203b240e38078d32d3b30ae2f764ba27d66c9d709e430b0eb1b4576314d99dd6177d8b88d19b89777 +EBUILD barrier-2.3.3.ebuild 1610 BLAKE2B cae50a8a315968c45ebe3a71da8fc66b3809b06e9f77fdf4f2e780804731ccb118cf4d85c9188edfa78b200bc07135d654fcead9f3e69860677af1b35d9e39d2 SHA512 46cd279a5c2bc53ac629b68605b9af845285e79da7308394e9932ff1ff1253c9d982b6bb529d4e1f57bb598dd1aad26069a5e6712bb9960e3c7eb788e8739ab8 MISC metadata.xml 329 BLAKE2B bbddf11c798d648935ee56a6ee9cbf7a73d30f13a880264ed07db3b7710eb7329166838b4e1adbb157b699805c2d891bdfae2799c7bb1b6ea3419b97438a49de SHA512 84462a8601400583e7570ecfca9fac2539eb9be9c097ebeead8cfc42e2be95c61369934a0e1d9252e3ed8fa181f64116a3cc0228da27340f6c29bdf5b4133883 diff --git a/x11-misc/barrier/barrier-2.3.2-r1.ebuild b/x11-misc/barrier/barrier-2.3.3.ebuild index 62b3dd6a5f97..502083619611 100644 --- a/x11-misc/barrier/barrier-2.3.2-r1.ebuild +++ b/x11-misc/barrier/barrier-2.3.3.ebuild @@ -3,7 +3,7 @@ EAPI=7 -inherit desktop xdg cmake +inherit desktop virtualx xdg cmake DESCRIPTION="Share a mouse and keyboard between computers (fork of Synergy)" HOMEPAGE="https://github.com/debauchee/barrier" @@ -12,7 +12,8 @@ SRC_URI="https://github.com/debauchee/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64" -IUSE="gui libressl" +IUSE="gui libressl test" +RESTRICT="!test? ( test )" RDEPEND=" net-misc/curl @@ -36,14 +37,13 @@ RDEPEND=" " DEPEND=" ${RDEPEND} + dev-cpp/gtest x11-base/xorg-proto " PATCHES=( - "${FILESDIR}"/${P}-inf-loop.patch - "${FILESDIR}"/${P}-no-avahi.patch - "${FILESDIR}"/${P}-pthread.patch - "${FILESDIR}"/${P}-qt-gui-only.patch + "${FILESDIR}"/${P}-tests.patch + "${FILESDIR}"/${P}-gtest.patch ) DOCS=( @@ -56,13 +56,20 @@ src_configure() { local mycmakeargs=( -DBARRIER_BUILD_GUI=$(usex gui) -DBARRIER_BUILD_INSTALLER=OFF + -DBARRIER_BUILD_TESTS=$(usex test) -DBARRIER_REVISION=00000000 + -DBARRIER_USE_EXTERNAL_GTEST=ON -DBARRIER_VERSION_STAGE=gentoo ) cmake_src_configure } +src_test() { + "${BUILD_DIR}"/bin/unittests || die + virtx "${BUILD_DIR}"/bin/integtests || die +} + src_install() { cmake_src_install einstalldocs diff --git a/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch b/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch deleted file mode 100644 index 125b903e58eb..000000000000 --- a/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch +++ /dev/null @@ -1,132 +0,0 @@ -From c79120c049d825fedeed70d5a1a9dc64d17ce9f0 Mon Sep 17 00:00:00 2001 -From: Vasily Galkin <galkin-vv@ya.ru> -Date: Sun, 9 Feb 2020 23:27:26 +0300 -Subject: [PATCH] Fix infinite loop on fast TCP disconnection - -The commit a841b28 changed the condition for removing job from processing. -New flag MultiplexerJobStatus::continue_servicing become used -instead of checking pointer for NULL. -However for cases when TCPSocket::newJob() returns nullptr -the behaviour changed: earlier the job was removed, but after change -it is called again, since MultiplexerJobStatus equal to {true, nullptr} -means "run this job again". - -This leads to problem with eating CPU and RAM on linux -https://github.com/debauchee/barrier/issues/470 - -There is similar windows problem, but not sure it is related. -https://github.com/debauchee/barrier/issues/552 - -Since it looks that the goal of a841b28 was only clarifying -object ownership and not changing job deletion behaviour, -this commit tries to get original behaviour and fix the bugs above -by returning {false, nullptr} instead of {true, nullptr} -when TCPSocket::newJob() returns nullptr. ---- - src/lib/net/SecureSocket.cpp | 4 ++-- - src/lib/net/TCPSocket.cpp | 25 +++++++++++++------------ - src/lib/net/TCPSocket.h | 3 ++- - 3 files changed, 17 insertions(+), 15 deletions(-) - -diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp -index 99f626e8..92abea3c 100644 ---- a/src/lib/net/SecureSocket.cpp -+++ b/src/lib/net/SecureSocket.cpp -@@ -761,7 +761,7 @@ MultiplexerJobStatus SecureSocket::serviceConnect(ISocketMultiplexerJob* job, - // If status > 0, success - if (status > 0) { - sendEvent(m_events->forIDataSocket().secureConnected()); -- return {true, newJob()}; -+ return newJobOrStopServicing(); - } - - // Retry case -@@ -793,7 +793,7 @@ MultiplexerJobStatus SecureSocket::serviceAccept(ISocketMultiplexerJob* job, - // If status > 0, success - if (status > 0) { - sendEvent(m_events->forClientListener().accepted()); -- return {true, newJob()}; -+ return newJobOrStopServicing(); - } - - // Retry case -diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp -index 4f4251ad..09a8f17e 100644 ---- a/src/lib/net/TCPSocket.cpp -+++ b/src/lib/net/TCPSocket.cpp -@@ -403,6 +403,15 @@ void TCPSocket::setJob(std::unique_ptr<ISocketMultiplexerJob>&& job) - } - } - -+MultiplexerJobStatus TCPSocket::newJobOrStopServicing() -+{ -+ auto new_job = newJob(); -+ if (new_job) -+ return {true, std::move(new_job)}; -+ else -+ return {false, {}}; -+} -+ - std::unique_ptr<ISocketMultiplexerJob> TCPSocket::newJob() - { - // note -- must have m_mutex locked on entry -@@ -519,22 +528,14 @@ MultiplexerJobStatus TCPSocket::serviceConnecting(ISocketMultiplexerJob* job, bo - catch (XArchNetwork& e) { - sendConnectionFailedEvent(e.what()); - onDisconnected(); -- auto new_job = newJob(); -- if (new_job) -- return {true, std::move(new_job)}; -- else -- return {false, {}}; -+ return newJobOrStopServicing(); - } - } - - if (write) { - sendEvent(m_events->forIDataSocket().connected()); - onConnected(); -- auto new_job = newJob(); -- if (new_job) -- return {true, std::move(new_job)}; -- else -- return {false, {}}; -+ return newJobOrStopServicing(); - } - - return {true, {}}; -@@ -548,7 +549,7 @@ MultiplexerJobStatus TCPSocket::serviceConnected(ISocketMultiplexerJob* job, - if (error) { - sendEvent(m_events->forISocket().disconnected()); - onDisconnected(); -- return {true, newJob()}; -+ return newJobOrStopServicing(); - } - - EJobResult writeResult = kRetry; -@@ -603,7 +604,7 @@ MultiplexerJobStatus TCPSocket::serviceConnected(ISocketMultiplexerJob* job, - if (writeResult == kBreak || readResult == kBreak) { - return {false, {}}; - } else if (writeResult == kNew || readResult == kNew) { -- return {true, newJob()}; -+ return newJobOrStopServicing(); - } else { - return {true, {}}; - } -diff --git a/src/lib/net/TCPSocket.h b/src/lib/net/TCPSocket.h -index 28891353..0b988886 100644 ---- a/src/lib/net/TCPSocket.h -+++ b/src/lib/net/TCPSocket.h -@@ -76,7 +76,8 @@ protected: - - void removeJob(); - void setJob(std::unique_ptr<ISocketMultiplexerJob>&& job); -- -+ MultiplexerJobStatus newJobOrStopServicing(); -+ - bool isReadable() { return m_readable; } - bool isWritable() { return m_writable; } - --- -2.24.1 - diff --git a/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch b/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch deleted file mode 100644 index 481a23a2d705..000000000000 --- a/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 93a4035409ed5a4349c9848c3dae3ec670884ee0 Mon Sep 17 00:00:00 2001 -From: Tetja Rediske <tetja+gitlab@tetja.de~> -Date: Sat, 19 Oct 2019 00:28:13 +0200 -Subject: [PATCH] make non-gui variants build without avahi - ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7f9efac8..8e10776e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -175,7 +175,7 @@ if (UNIX) - link_directories("/usr/X11R6/lib") - endif() - -- if (${PKG_CONFIG_FOUND}) -+ if (BARRIER_BUILD_GUI AND ${PKG_CONFIG_FOUND}) - pkg_check_modules (AVAHI_COMPAT REQUIRED avahi-compat-libdns_sd) - include_directories (BEFORE SYSTEM ${AVAHI_COMPAT_INCLUDE_DIRS}) - set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${AVAHI_COMPAT_INCLUDE_DIRS}") --- -2.24.1 - diff --git a/x11-misc/barrier/files/barrier-2.3.2-pthread.patch b/x11-misc/barrier/files/barrier-2.3.2-pthread.patch deleted file mode 100644 index d29844843e45..000000000000 --- a/x11-misc/barrier/files/barrier-2.3.2-pthread.patch +++ /dev/null @@ -1,115 +0,0 @@ -From a0b3124f80f5696cbf070b3b714533ab4012398d Mon Sep 17 00:00:00 2001 -From: James Le Cuirot <chewi@gentoo.org> -Date: Tue, 10 Mar 2020 21:10:48 +0000 -Subject: [PATCH] Use -pthread flag and simplify pthread build logic - -Sometimes -lpthread is not enough. This has caused build failures on -Gentoo Linux in the past. - -The logic also seems needlessly complex. We check for HAVE_PTHREAD on -UNIX platforms even though CMake errors out if pthreads are not -found. Similarly, we have a fallback for HAVE_PTHREAD_SIGNAL being -false even though we always set it to true. ---- - CMakeLists.txt | 11 ++++------- - res/config.h.in | 6 ------ - src/lib/arch/Arch.h | 4 +--- - src/lib/arch/unix/ArchMultithreadPosix.cpp | 13 ------------- - 4 files changed, 5 insertions(+), 29 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8e10776e..ae7ccb21 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -123,12 +123,10 @@ if (UNIX) - check_type_size (short SIZEOF_SHORT) - - # pthread is used on both Linux and Mac -- check_library_exists ("pthread" pthread_create "" HAVE_PTHREAD) -- if (HAVE_PTHREAD) -- list (APPEND libs pthread) -- else() -- message (FATAL_ERROR "Missing library: pthread") -- endif() -+ set (CMAKE_THREAD_PREFER_PTHREAD TRUE) -+ set (THREADS_PREFER_PTHREAD_FLAG TRUE) -+ find_package (Threads REQUIRED) -+ list (APPEND libs Threads::Threads) - - # curl is used on both Linux and Mac - find_package (CURL) -@@ -269,7 +267,6 @@ if (UNIX) - set (HAVE_CXX_EXCEPTIONS 1) - set (HAVE_CXX_MUTABLE 1) - set (HAVE_CXX_STDLIB 1) -- set (HAVE_PTHREAD_SIGNAL 1) - set (SELECT_TYPE_ARG1 int) - set (SELECT_TYPE_ARG234 " (fd_set *)") - set (SELECT_TYPE_ARG5 " (struct timeval *)") -diff --git a/res/config.h.in b/res/config.h.in -index f3a72449..2bd3b3bf 100644 ---- a/res/config.h.in -+++ b/res/config.h.in -@@ -55,12 +55,6 @@ - /* Define if you have a POSIX `sigwait` function. */ - #cmakedefine HAVE_POSIX_SIGWAIT ${HAVE_POSIX_SIGWAIT} - --/* Define if you have POSIX threads libraries and header files. */ --#cmakedefine HAVE_PTHREAD ${HAVE_PTHREAD} -- --/* Define if you have `pthread_sigmask` and `pthread_kill` functions. */ --#cmakedefine HAVE_PTHREAD_SIGNAL ${HAVE_PTHREAD_SIGNAL} -- - /* Define if your compiler defines socklen_t. */ - #cmakedefine HAVE_SOCKLEN_T ${HAVE_SOCKLEN_T} - -diff --git a/src/lib/arch/Arch.h b/src/lib/arch/Arch.h -index c062d6f3..940a2e3a 100644 ---- a/src/lib/arch/Arch.h -+++ b/src/lib/arch/Arch.h -@@ -54,9 +54,7 @@ - # include "arch/unix/ArchConsoleUnix.h" - # include "arch/unix/ArchDaemonUnix.h" - # include "arch/unix/ArchLogUnix.h" --# if HAVE_PTHREAD --# include "arch/unix/ArchMultithreadPosix.h" --# endif -+# include "arch/unix/ArchMultithreadPosix.h" - # include "arch/unix/ArchNetworkBSD.h" - # include "arch/unix/ArchSleepUnix.h" - # include "arch/unix/ArchStringUnix.h" -diff --git a/src/lib/arch/unix/ArchMultithreadPosix.cpp b/src/lib/arch/unix/ArchMultithreadPosix.cpp -index c9ddc6ce..4866edce 100644 ---- a/src/lib/arch/unix/ArchMultithreadPosix.cpp -+++ b/src/lib/arch/unix/ArchMultithreadPosix.cpp -@@ -36,17 +36,6 @@ - - #define SIGWAKEUP SIGUSR1 - --#if !HAVE_PTHREAD_SIGNAL -- // boy, is this platform broken. forget about pthread signal -- // handling and let signals through to every process. barrier -- // will not terminate cleanly when it gets SIGTERM or SIGINT. --# define pthread_sigmask sigprocmask --# define pthread_kill(tid_, sig_) kill(0, (sig_)) --# define sigwait(set_, sig_) --# undef HAVE_POSIX_SIGWAIT --# define HAVE_POSIX_SIGWAIT 1 --#endif -- - static - void - setSignalSet(sigset_t* sigset) -@@ -344,9 +333,7 @@ ArchMultithreadPosix::newThread(ThreadFunc func, void* data) - // can't tell the difference. - if (!m_newThreadCalled) { - m_newThreadCalled = true; --#if HAVE_PTHREAD_SIGNAL - startSignalHandler(); --#endif - } - - // note that the child thread will wait until we release this mutex --- -2.24.1 - diff --git a/x11-misc/barrier/files/barrier-2.3.2-qt-gui-only.patch b/x11-misc/barrier/files/barrier-2.3.2-qt-gui-only.patch deleted file mode 100644 index bcfe31386103..000000000000 --- a/x11-misc/barrier/files/barrier-2.3.2-qt-gui-only.patch +++ /dev/null @@ -1,45 +0,0 @@ -From af0ce63733e040d6220aaa2157190015d4a9b0fd Mon Sep 17 00:00:00 2001 -From: James Le Cuirot <chewi@gentoo.org> -Date: Tue, 17 Mar 2020 22:45:20 +0000 -Subject: [PATCH] Only require Qt5 when building the GUI - -Commit 6c888437 made Qt5 mandatory for all builds when it is only -required for the GUI. There's already a find_package call in src/gui, -it just needed the REQUIRED flag to be added. ---- - CMakeLists.txt | 6 ------ - src/gui/CMakeLists.txt | 2 +- - 2 files changed, 1 insertion(+), 7 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8e10776e..ee0835ec 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -357,12 +357,6 @@ else() - set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto}) - endif() - -- --# Check we have the *required* Qt5 libs. --find_package(Qt5Core REQUIRED) --find_package(Qt5Network REQUIRED) --find_package(Qt5Widgets REQUIRED) -- - # - # Configure_file... but for directories, recursively. - # -diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt -index 4988fe6a..f29fd910 100644 ---- a/src/gui/CMakeLists.txt -+++ b/src/gui/CMakeLists.txt -@@ -1,6 +1,6 @@ - cmake_minimum_required (VERSION 3.4) - --find_package (Qt5 COMPONENTS Core Widgets Network) -+find_package (Qt5 REQUIRED COMPONENTS Core Widgets Network) - set (CMAKE_AUTOMOC ON) - set (CMAKE_AUTORCC ON) - set (CMAKE_AUTOUIC ON) --- -2.25.1 - diff --git a/x11-misc/barrier/files/barrier-2.3.3-gtest.patch b/x11-misc/barrier/files/barrier-2.3.3-gtest.patch new file mode 100644 index 000000000000..363f8c2c02c0 --- /dev/null +++ b/x11-misc/barrier/files/barrier-2.3.3-gtest.patch @@ -0,0 +1,116 @@ +From bd1db368b333783697d686c82c42e48c4bec8b9e Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Fri, 21 Aug 2020 23:13:58 +0100 +Subject: [PATCH] Add BARRIER_USE_EXTERNAL_GTEST CMake option to use external + GTest + +--- + CMakeLists.txt | 1 + + src/test/CMakeLists.txt | 38 ++++++++++++++++++++---------- + src/test/integtests/CMakeLists.txt | 4 +--- + src/test/unittests/CMakeLists.txt | 4 +--- + 4 files changed, 29 insertions(+), 18 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4947d20f..18b242db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -21,6 +21,7 @@ project (barrier C CXX) + option (BARRIER_BUILD_GUI "Build the GUI" ON) + option (BARRIER_BUILD_INSTALLER "Build the installer" ON) + option (BARRIER_BUILD_TESTS "Build the tests" ON) ++option (BARRIER_USE_EXTERNAL_GTEST "Use external installation of Google Test framework" OFF) + + set (CMAKE_EXPORT_COMPILE_COMMANDS ON) + set (CMAKE_CXX_STANDARD 14) +diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt +index daecb317..4a50e701 100644 +--- a/src/test/CMakeLists.txt ++++ b/src/test/CMakeLists.txt +@@ -14,19 +14,33 @@ + # 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 (BARRIER_USE_EXTERNAL_GTEST) ++ include (FindPkgConfig) ++ find_package(GTest REQUIRED) ++ pkg_check_modules(GMOCK REQUIRED gmock) ++ include_directories( ++ ${GTEST_INCLUDE_DIRS} ++ ${GMOCK_INCLUDE_DIRS} ++ ) ++else() ++ include_directories( ++ ../../ext/gtest ++ ../../ext/gtest/include ++ ../../ext/gmock ++ ../../ext/gmock/include ++ ) + +-if (UNIX) +- # ignore warnings in gtest and gmock +- set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w") +- set_target_properties(gmock PROPERTIES COMPILE_FLAGS "-w") ++ add_library(gtest STATIC ../../ext/gtest/src/gtest-all.cc) ++ add_library(gmock STATIC ../../ext/gmock/src/gmock-all.cc) ++ ++ set(GTEST_LIBRARIES gtest) ++ set(GMOCK_LIBRARIES gmock) ++ ++ 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() + endif() + + add_subdirectory(integtests) +diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt +index 0460d8df..9ef875bd 100644 +--- a/src/test/integtests/CMakeLists.txt ++++ b/src/test/integtests/CMakeLists.txt +@@ -68,8 +68,6 @@ endif() + + include_directories( + ../../ +- ../../../ext/gtest/include +- ../../../ext/gmock/include + ) + + if (UNIX) +@@ -80,4 +78,4 @@ endif() + + add_executable(integtests ${sources}) + target_link_libraries(integtests +- arch base client common io ipc mt net platform server synlib gtest gmock ${libs} ${OPENSSL_LIBS}) ++ arch base client common io ipc mt net platform server synlib ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${libs} ${OPENSSL_LIBS}) +diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt +index c46375ce..61a0d35f 100644 +--- a/src/test/unittests/CMakeLists.txt ++++ b/src/test/unittests/CMakeLists.txt +@@ -50,8 +50,6 @@ list(APPEND headers ${platform_sources}) + + include_directories( + ../../ +- ../../../ext/gtest/include +- ../../../ext/gmock/include + ../../../ext + ) + +@@ -67,4 +65,4 @@ endif() + + add_executable(unittests ${sources}) + target_link_libraries(unittests +- arch base client server common io net platform server synlib mt ipc gtest gmock ${libs} ${OPENSSL_LIBS}) ++ arch base client server common io net platform server synlib mt ipc ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${libs} ${OPENSSL_LIBS}) +-- +2.26.2 + diff --git a/x11-misc/barrier/files/barrier-2.3.3-tests.patch b/x11-misc/barrier/files/barrier-2.3.3-tests.patch new file mode 100644 index 000000000000..a4cc0d665a07 --- /dev/null +++ b/x11-misc/barrier/files/barrier-2.3.3-tests.patch @@ -0,0 +1,150 @@ +From 4a031b8ce538af0c15857c37c1964bf144d5bc38 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Fri, 21 Aug 2020 22:22:48 +0100 +Subject: [PATCH] Add BARRIER_BUILD_TESTS CMake option to make tests optional + +--- + CMakeLists.txt | 2 +- + src/CMakeLists.txt | 5 ++++- + src/lib/barrier/KeyMap.h | 4 ++++ + src/test/unittests/barrier/KeyMapTests.cpp | 2 ++ + 4 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6a377c04..4947d20f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,6 +20,7 @@ project (barrier C CXX) + + option (BARRIER_BUILD_GUI "Build the GUI" ON) + option (BARRIER_BUILD_INSTALLER "Build the installer" ON) ++option (BARRIER_BUILD_TESTS "Build the tests" ON) + + set (CMAKE_EXPORT_COMPILE_COMMANDS ON) + set (CMAKE_CXX_STANDARD 14) +@@ -49,7 +50,6 @@ else() + endif() + + set (libs) +-include_directories (BEFORE SYSTEM ./ext/gtest/include) + + if (UNIX) + if (NOT APPLE) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 55aad09d..c3dea51f 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -19,7 +19,10 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}/lib) + + add_subdirectory(lib) + add_subdirectory(cmd) +-add_subdirectory(test) ++ ++if (BARRIER_BUILD_TESTS) ++ add_subdirectory(test) ++endif() + + if (BARRIER_BUILD_GUI) + add_subdirectory(gui) +diff --git a/src/lib/barrier/KeyMap.h b/src/lib/barrier/KeyMap.h +index b6eb8658..812b4d26 100644 +--- a/src/lib/barrier/KeyMap.h ++++ b/src/lib/barrier/KeyMap.h +@@ -24,7 +24,9 @@ + #include "common/stdset.h" + #include "common/stdvector.h" + ++#ifdef TEST_ENV + #include <gtest/gtest_prod.h> ++#endif + + namespace barrier { + +@@ -327,6 +329,7 @@ public: + //@} + + private: ++#ifdef TEST_ENV + FRIEND_TEST(KeyMapTests, + findBestKey_requiredDown_matchExactFirstItem); + FRIEND_TEST(KeyMapTests, +@@ -340,6 +343,7 @@ private: + FRIEND_TEST(KeyMapTests, + findBestKey_onlyOneRequiredDown_matchTwoRequiredChangesItem); + FRIEND_TEST(KeyMapTests, findBestKey_noRequiredDown_cannotMatch); ++#endif + + private: + //! Ways to synthesize a key +diff --git a/src/test/unittests/barrier/KeyMapTests.cpp b/src/test/unittests/barrier/KeyMapTests.cpp +index 59806339..c0832199 100644 +--- a/src/test/unittests/barrier/KeyMapTests.cpp ++++ b/src/test/unittests/barrier/KeyMapTests.cpp +@@ -15,6 +15,8 @@ + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + ++#define TEST_ENV ++ + #include "barrier/KeyMap.h" + + #include "test/global/gtest.h" +-- +2.26.2 + +From 19e020080cb3f54befb504abc48cf304ab42f23e Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <chewi@gentoo.org> +Date: Sat, 22 Aug 2020 11:46:25 +0100 +Subject: [PATCH] Respect DISPLAY environment variable in XWindows tests + +XWindowsScreenTests was failing under Gentoo's package manager. I have +also addressed this in XWindowsScreenSaverTests, which is currently +unused. +--- + src/test/integtests/platform/XWindowsScreenSaverTests.cpp | 7 ++++++- + src/test/integtests/platform/XWindowsScreenTests.cpp | 7 ++++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp +index c6a2710c..1ee273ed 100644 +--- a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp ++++ b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp +@@ -30,7 +30,12 @@ using ::testing::_; + // TODO: not working on build machine for some reason + TEST(CXWindowsScreenSaverTests, activate_defaultScreen_todo) + { +- Display* display = XOpenDisplay(":0.0"); ++ const char* displayName = getenv("DISPLAY"); ++ if (displayName == NULL) { ++ displayName = ":0.0"; ++ } ++ ++ Display* display = XOpenDisplay(displayName); + Window window = DefaultRootWindow(display); + MockEventQueue eventQueue; + EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(1); +diff --git a/src/test/integtests/platform/XWindowsScreenTests.cpp b/src/test/integtests/platform/XWindowsScreenTests.cpp +index d8f75e15..97358197 100644 +--- a/src/test/integtests/platform/XWindowsScreenTests.cpp ++++ b/src/test/integtests/platform/XWindowsScreenTests.cpp +@@ -25,11 +25,16 @@ using ::testing::_; + + TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect) + { ++ const char* displayName = getenv("DISPLAY"); ++ if (displayName == NULL) { ++ displayName = ":0.0"; ++ } ++ + MockEventQueue eventQueue; + EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2); + EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2); + EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2); +- XWindowsScreen screen(new XWindowsImpl(), ":0.0", false, false, 0, &eventQueue); ++ XWindowsScreen screen(new XWindowsImpl(), displayName, false, false, 0, &eventQueue); + + screen.fakeMouseMove(10, 20); + +-- +2.26.2 + |