test: make thread_priority robust against system default nice levels

The test previously assumed a default nice value of 0, but this can vary
depending on PAM configuration, /etc/security/limits.conf, or other environment
settings.

Fixes: https://github.com/libuv/libuv/issues/4898
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Juan José Arboleda 2025-10-02 21:42:49 -05:00
parent 74079a8e47
commit 0a2631f92f

View File

@ -88,8 +88,6 @@ TEST_IMPL(thread_priority) {
* test set nice value for the calling thread with default schedule policy
*/
#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));
@ -108,4 +106,4 @@ TEST_IMPL(thread_priority) {
#endif
return 0;
}
}