Case pthread_cond_signal/1-1 fails on routerstation. The OS is Yocto
linux 1.2 with kernel 3.0.24, and c library is eglibc 2.15.
The fail log:
[Thread 0x0x2c56d4b0] started and locked the mutex
[Thread 0x0x2c56d4b0] is waiting for the cond
[Thread 0x0x2bd6d4b0] started and locked the mutex
[Thread 0x0x2bd6d4b0] is waiting for the cond
[Thread 0x0x2b56d4b0] started and locked the mutex
[Thread 0x0x2b56d4b0] is waiting for the cond
[Main thread] signals a condition
[Thread 0x0x2c56d4b0] was wakened and acquired the mutex again
[Thread 0x0x2c56d4b0] released the mutex
[Main thread] 1 waiters were wakened
[Main thread] signals to wake up the next thread
[Thread 0x0x2bd6d4b0] was wakened and acquired the mutex again
[Thread 0x0x2bd6d4b0] released the mutex
[Main thread] signals to wake up the next thread
[Main thread] signals to wake up the next thread
[Main thread] signals to wake up the next thread
[Main thread] signals to wake up the next thread
[Main thread] signals to wake up the next thread
[Thread 0x0x2b56d4b0] was wakened and acquired the mutex again
[Main thread] had to signal the condition 7 times
[Main thread] to wake up 3 threads
. Test FAILED.
The main thread call pthread_cond_signal try to signal the child threads
those are waiting on the condition, then call usleep(100) to relinquish
the cpu. But 100 useconds is not enough and the main thread continue to
run. So the case fails.
Increase the sleep timeto 1000 useconds to make the case pass.
Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
.../interfaces/pthread_cond_signal/1-1.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
index bf55b31..910931d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
@@ -142,7 +142,7 @@ int main()
fprintf(stderr,"Main failed to signal the condition\n");
exit(PTS_UNRESOLVED);
}
- usleep(100);
+ usleep(1000);
}
if (i >= THREAD_NUM) {
@@ -160,4 +160,4 @@ int main()
}
printf("Test PASSED\n");
return PTS_PASS;
-}
\ No newline at end of file
+}