File: fix-thread-priority-test

package info (click to toggle)
libuv1 1.52.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,812 kB
  • sloc: ansic: 75,557; makefile: 676; python: 189; sh: 51; javascript: 18
file content (26 lines) | stat: -rw-r--r-- 987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: Fix thread priority test
 Test should not assume to be run at priority 0.
 .
 See upstream bug for more details.
Bug: https://github.com/libuv/libuv/issues/4382
Bug-Debian: https://bugs.debian.org/1071194
Author: info@bnoordhuis.nl
Origin: https://github.com/libuv/libuv/issues/4382
Applied-Upstream: not-needed
--- a/test/test-thread-priority.c
+++ b/test/test-thread-priority.c
@@ -88,9 +88,11 @@
  * test set nice value for the calling thread with default schedule policy
 */
 #ifdef __linux__
-  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) {
+    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);