aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-12-26 21:37:17 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-12-26 21:37:17 +0000
commit18d19bd150115af9bc6a1135fe04fbf11396410a (patch)
tree6a96b342a257b2cc0c9ec2fb4738fa1b09eeeba9 /gdb
parente809353af1682550b6f19bdd0fe4a3628d7380cd (diff)
downloadgdb-18d19bd150115af9bc6a1135fe04fbf11396410a.zip
gdb-18d19bd150115af9bc6a1135fe04fbf11396410a.tar.gz
gdb-18d19bd150115af9bc6a1135fe04fbf11396410a.tar.bz2
gdb/testsuite/
Fix racy FAILs. * gdb.threads/fork-thread-pending.c (barrier): New variable. (thread_function, thread_forker): Call pthread_barrier_wait for it. (main): Call pthread_barrier_init for it.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.threads/fork-thread-pending.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9b540e4..9dcc359 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2011-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix racy FAILs.
+ * gdb.threads/fork-thread-pending.c (barrier): New variable.
+ (thread_function, thread_forker): Call pthread_barrier_wait for it.
+ (main): Call pthread_barrier_init for it.
+
+2011-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix double send_gdb leading to racy FAILs.
* gdb.base/break.exp (set silent break bp_location1): Replace
3x send_gdb and gdb_expect by gdb_test.
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.c b/gdb/testsuite/gdb.threads/fork-thread-pending.c
index bc9026c..d2ced96 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.c
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.c
@@ -28,6 +28,7 @@
#define NUMTHREADS 10
volatile int done = 0;
+static pthread_barrier_t barrier;
static void *
start (void *arg)
@@ -45,6 +46,8 @@ thread_function (void *arg)
printf ("Thread <%d> executing\n", x);
+ pthread_barrier_wait (&barrier);
+
while (!done)
usleep (100);
@@ -62,6 +65,8 @@ thread_forker (void *arg)
printf ("Thread forker <%d> executing\n", x);
+ pthread_barrier_wait (&barrier);
+
switch ((pid = fork ()))
{
case -1:
@@ -89,6 +94,9 @@ main (void)
int args[NUMTHREADS];
int i, j;
+ i = pthread_barrier_init (&barrier, NULL, NUMTHREADS);
+ assert (i == 0);
+
/* Create a few threads that do mostly nothing, and then one that
forks. */
for (j = 0; j < NUMTHREADS - 1; ++j)