commit:     3969a15b3da3dd8fe29a7451f013c7c92f61860b
Author:     Ronny (tastytea) Gutbrod <gentoo <AT> tastytea <DOT> de>
AuthorDate: Thu Sep  8 15:52:50 2022 +0000
Commit:     Ronny Gutbrod <gentoo <AT> tastytea <DOT> de>
CommitDate: Thu Sep  8 15:56:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3969a15b

dev-cpp/drogon: fix race condition in tests

Closes: https://bugs.gentoo.org/868930
Signed-off-by: Ronny (tastytea) Gutbrod <gentoo <AT> tastytea.de>

 dev-cpp/drogon/drogon-1.8.0-r1.ebuild              |  2 ++
 .../drogon-1.8.0-fix-tests-race-condition.patch    | 37 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/dev-cpp/drogon/drogon-1.8.0-r1.ebuild 
b/dev-cpp/drogon/drogon-1.8.0-r1.ebuild
index 784892098..a884fc440 100644
--- a/dev-cpp/drogon/drogon-1.8.0-r1.ebuild
+++ b/dev-cpp/drogon/drogon-1.8.0-r1.ebuild
@@ -41,6 +41,8 @@ DEPEND="${RDEPEND}
 "
 BDEPEND="doc? ( app-doc/doxygen )"
 
+PATCHES=( "${FILESDIR}"/${P}-fix-tests-race-condition.patch )
+
 DOCS=( CONTRIBUTING.md ChangeLog.md README.md README.zh-CN.md README.zh-TW.md )
 
 src_unpack() {

diff --git a/dev-cpp/drogon/files/drogon-1.8.0-fix-tests-race-condition.patch 
b/dev-cpp/drogon/files/drogon-1.8.0-fix-tests-race-condition.patch
new file mode 100644
index 000000000..efeeb5a3d
--- /dev/null
+++ b/dev-cpp/drogon/files/drogon-1.8.0-fix-tests-race-condition.patch
@@ -0,0 +1,37 @@
+# Upstream PR (modified): <https://github.com/drogonframework/drogon/pull/1376>
+# Bug: <https://bugs.gentoo.org/868930>
+
+From eb0d322f40967883c8b1fb7aad7d00827c2f819c Mon Sep 17 00:00:00 2001
+From: an-tao <[email protected]>
+Date: Thu, 8 Sep 2022 11:06:30 +0800
+Subject: [PATCH] Fix a test bug when clients start before servers
+
+---
+ lib/tests/RealIpResolverTest.cc  | 1 +
+ lib/tests/main_CookieSameSite.cc | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/lib/tests/RealIpResolverTest.cc b/lib/tests/RealIpResolverTest.cc
+index e3d4cfb66..612174d45 100644
+--- a/lib/tests/RealIpResolverTest.cc
++++ b/lib/tests/RealIpResolverTest.cc
+@@ -139,6 +139,7 @@ int main(int argc, char **argv)
+     });
+ 
+     f1.get();
++    std::this_thread::sleep_for(std::chrono::milliseconds(200));
+     int testStatus = test::run(argc, argv);
+     app().getLoop()->queueInLoop([]() { app().quit(); });
+     thr.join();
+diff --git a/lib/tests/main_CookieSameSite.cc 
b/lib/tests/main_CookieSameSite.cc
+index b271e7a42..43f76198f 100644
+--- a/lib/tests/main_CookieSameSite.cc
++++ b/lib/tests/main_CookieSameSite.cc
+@@ -68,6 +68,7 @@ int main(int argc, char **argv)
+     });
+ 
+     f1.get();
++    std::this_thread::sleep_for(std::chrono::milliseconds(200));
+     int testStatus = test::run(argc, argv);
+     app().getLoop()->queueInLoop([]() { app().quit(); });
+     thr.join();

Reply via email to