From: openKylin Developers <packaging@lists.openkylin.top>
Date: Sun, 31 May 2026 06:23:08 -0700
Subject: Fix thread priority test

Bug: https://github.com/libuv/libuv/issues/4382
Bug-Debian: https://bugs.debian.org/1071194
Origin: https://github.com/libuv/libuv/issues/4382
Applied-Upstream: not-needed

Test should not assume to be run at priority 0.

See upstream bug for more details.
---
 test/test-thread-priority.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/test/test-thread-priority.c b/test/test-thread-priority.c
index 0aaf297..4df3ce3 100644
--- a/test/test-thread-priority.c
+++ b/test/test-thread-priority.c
@@ -89,10 +89,12 @@ TEST_IMPL(thread_priority) {
 */
 #ifdef __linux__
   ASSERT_OK(uv_thread_getpriority(pthread_self(), &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));
+  if (priority == 0 ) {
+      // do not run test when process is run with nice (seen on Debian)
+      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 +104,4 @@ TEST_IMPL(thread_priority) {
   uv_sem_destroy(&sem);
 
   return 0;
-}
\ No newline at end of file
+}
