Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] testsuite: pthread_cond_wait.exp: Avoid a race
@ 2013-02-12 17:04 Jan Kratochvil
  2013-02-12 17:23 ` Joel Brobecker
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2013-02-12 17:04 UTC (permalink / raw)
  To: gdb-patches

Hi,

-PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
+FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread

-Thread 2 (Thread 0xf7dd6b40 (LWP 4893)):^M
+Thread 2 (Thread 0xf7dd6b40 (LWP 4754)):^M
 #0  0xf7fdc430 in __kernel_vsyscall ()^M
-#1  0xf7fc012c in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:172^M
-#2  0x08048683 in cond_wait (cond=0xf7dd6308, mut=0xf7dd6338) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:28^M
-#3  0x080486ce in noreturn () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:43^M
-#4  0x080486db in forever_pthread (unused=0x0) at gdb/testsuite/gdb.threads/pthread_cond_wait.c:49^M
-#5  0xf7fbcadf in start_thread (arg=0xf7dd6b40) at pthread_create.c:309^M
-#6  0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M
+#1  0xf7fc2dd2 in __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S:98^M
+#2  0xf7fbd7b2 in _L_lock_3175 () from /lib/libpthread.so.0^M
+#3  0xf7fbccc9 in start_thread (arg=0xf7dd6b40) at pthread_create.c:298^M
+#4  0xf7ecd42e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133^M
 ^M
-Thread 1 (Thread 0xf7dd76c0 (LWP 4745)):^M
+Thread 1 (Thread 0xf7dd76c0 (LWP 4628)):^M
 #0  break_me () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:56^M
 #1  0x08048738 in main () at gdb/testsuite/gdb.threads/pthread_cond_wait.c:68^M
-(gdb) PASS: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread
+(gdb) FAIL: gdb.threads/pthread_cond_wait.exp: backtrace in blocked thread


It is just too racy.  I will check in the easy workaround below, it is sure not
a real fix.


Thanks,
Jan


gdb/testsuite/
2013-02-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.threads/pthread_cond_wait.c (main): Remove variable ts.  Replace
	nanosleep by sleep.

diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
index a639e41..3c28e13 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
@@ -59,12 +59,11 @@ int
 main (void)
 {
   pthread_t forever;
-  const struct timespec ts = { 0, 10000000 }; /* 0.01 sec */
 
   pthread_create (&forever, NULL, forever_pthread, NULL);
   for (;;)
     {
-      nanosleep (&ts, NULL);
+      sleep (2);
       break_me();
     }
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-02-14 15:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 17:04 [patch] testsuite: pthread_cond_wait.exp: Avoid a race Jan Kratochvil
2013-02-12 17:23 ` Joel Brobecker
2013-02-12 17:30   ` Jan Kratochvil
2013-02-12 17:39     ` Joel Brobecker
2013-02-12 20:13       ` Tom Tromey
2013-02-14 15:25       ` [commit] " Jan Kratochvil
2013-02-12 17:41     ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox