commit:     7ab66de3c35d5310271b9b805543d375aea82b0d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 09:48:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 09:49:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ab66de3

dev-libs/libuv: skip part of thread_priority test

Part of the (newly-introduced) thread_priority test doesn't interact well
with PORTAGE_NICENESS, (maybe) PORTAGE_IONICE_COMMAND, and 
PORTAGE_SCHEDULING_POLICY.

For example, with PORTAGE_NICENESS="18", PORTAGE_IONICE_COMMAND="ionice -c 3 -p 
\${PID}",
and PORTAGE_SCHEDULING_POLICY="idle", I get:
```
not ok 354 - thread_priority
 exit code 134
 Output from process `thread_priority`:
 Assertion failed in test/test-thread-priority.c on line 95: `priority == (0 - 
UV_THREAD_PRIORITY_LOWEST * 2)` (0 == 4)
```

Skip that one assertion accordingly.

And while at it, elaborate on a bit of m4 hackery we do in the ebuild.

Closes: https://bugs.gentoo.org/924653
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../libuv-1.48.0-test-thread-priority-portage.patch | 21 +++++++++++++++++++++
 dev-libs/libuv/libuv-1.48.0.ebuild                  | 11 +++++++----
 dev-libs/libuv/libuv-9999.ebuild                    | 11 +++++++----
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git 
a/dev-libs/libuv/files/libuv-1.48.0-test-thread-priority-portage.patch 
b/dev-libs/libuv/files/libuv-1.48.0-test-thread-priority-portage.patch
new file mode 100644
index 000000000000..6cefebacf2af
--- /dev/null
+++ b/dev-libs/libuv/files/libuv-1.48.0-test-thread-priority-portage.patch
@@ -0,0 +1,21 @@
+This test fails in Portage with aggressive PORTAGE_NICENESS, 
PORTAGE_IONICE_COMMAND,
+and PORTAGE_SCHEDULING_POLICY.
+
+Bug: https://bugs.gentoo.org/924653
+--- a/test/test-thread-priority.c
++++ b/test/test-thread-priority.c
+@@ -92,7 +92,6 @@ TEST_IMPL(thread_priority) {
+   ASSERT_EQ(priority, 0);
+   ASSERT_OK(uv_thread_setpriority(pthread_self(), UV_THREAD_PRIORITY_LOWEST));
+   ASSERT_OK(uv_thread_getpriority(pthread_self(), &priority));
+-  ASSERT_EQ(priority, (0 - UV_THREAD_PRIORITY_LOWEST * 2));
+ #endif
+ 
+   uv_sem_post(&sem);
+@@ -102,4 +101,4 @@ TEST_IMPL(thread_priority) {
+   uv_sem_destroy(&sem);
+ 
+   return 0;
+-}
+\ No newline at end of file
++}

diff --git a/dev-libs/libuv/libuv-1.48.0.ebuild 
b/dev-libs/libuv/libuv-1.48.0.ebuild
index 3ece11e123c5..056ed6900a01 100644
--- a/dev-libs/libuv/libuv-1.48.0.ebuild
+++ b/dev-libs/libuv/libuv-1.48.0.ebuild
@@ -30,17 +30,20 @@ BDEPEND="
        verify-sig? ( sec-keys/openpgp-keys-libuv )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.48.0-test-thread-priority-portage.patch
+)
+
 src_prepare() {
        default
 
-       echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" \
-               > m4/libuv-extra-automake-flags.m4 || die
-
        if [[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] ; then
                eapply "${FILESDIR}"/${PN}-1.41.0-darwin.patch
        fi
 
-       # Upstream fails to ship a configure script
+       # Upstream fails to ship a configure script and has missing m4 file.
+       echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" \
+               > m4/libuv-extra-automake-flags.m4 || die
        eautoreconf
 }
 

diff --git a/dev-libs/libuv/libuv-9999.ebuild b/dev-libs/libuv/libuv-9999.ebuild
index 3ece11e123c5..056ed6900a01 100644
--- a/dev-libs/libuv/libuv-9999.ebuild
+++ b/dev-libs/libuv/libuv-9999.ebuild
@@ -30,17 +30,20 @@ BDEPEND="
        verify-sig? ( sec-keys/openpgp-keys-libuv )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.48.0-test-thread-priority-portage.patch
+)
+
 src_prepare() {
        default
 
-       echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" \
-               > m4/libuv-extra-automake-flags.m4 || die
-
        if [[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] ; then
                eapply "${FILESDIR}"/${PN}-1.41.0-darwin.patch
        fi
 
-       # Upstream fails to ship a configure script
+       # Upstream fails to ship a configure script and has missing m4 file.
+       echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" \
+               > m4/libuv-extra-automake-flags.m4 || die
        eautoreconf
 }
 

Reply via email to