]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add some regression tests for pthread_barrier handling.
authorJulian Seward <jseward@acm.org>
Fri, 14 Nov 2008 19:43:44 +0000 (19:43 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 14 Nov 2008 19:43:44 +0000 (19:43 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8768

19 files changed:
helgrind/tests/Makefile.am
helgrind/tests/bar_bad.c [new file with mode: 0644]
helgrind/tests/bar_bad.stderr.exp-glibc28-amd64 [new file with mode: 0644]
helgrind/tests/bar_bad.stdout.exp [new file with mode: 0644]
helgrind/tests/bar_bad.vgtest [new file with mode: 0644]
helgrind/tests/bar_trivial.c [new file with mode: 0644]
helgrind/tests/bar_trivial.stderr.exp-glibc28-amd64 [new file with mode: 0644]
helgrind/tests/bar_trivial.stdout.exp [new file with mode: 0644]
helgrind/tests/bar_trivial.vgtest [new file with mode: 0644]
helgrind/tests/filter_threadnums [new file with mode: 0755]
helgrind/tests/pth_barrier1.stderr.exp-glibc28-amd64 [new file with mode: 0644]
helgrind/tests/pth_barrier1.stdout.exp [new file with mode: 0644]
helgrind/tests/pth_barrier1.vgtest [new file with mode: 0644]
helgrind/tests/pth_barrier2.stderr.exp-glibc28-amd64 [new file with mode: 0644]
helgrind/tests/pth_barrier2.stdout.exp [new file with mode: 0644]
helgrind/tests/pth_barrier2.vgtest [new file with mode: 0644]
helgrind/tests/pth_barrier3.stderr.exp-glibc28-amd64 [new file with mode: 0644]
helgrind/tests/pth_barrier3.stdout.exp [new file with mode: 0644]
helgrind/tests/pth_barrier3.vgtest [new file with mode: 0644]

index 310b96632408aae83cb3defb3f13dfb2a9207025..35e15bb9fc00ebf6f4372896e8fd709a5d7e49a7 100644 (file)
@@ -2,9 +2,13 @@
 # For AM_FLAG_M3264_PRI
 include $(top_srcdir)/Makefile.flags.am
 
-noinst_SCRIPTS = filter_stderr
+noinst_SCRIPTS = filter_stderr filter_threadnums
 
 EXTRA_DIST = $(noinst_SCRIPTS) \
+       bar_bad.vgtest bar_bad.stdout.exp \
+               bar_bad.stderr.exp-glibc28-amd64 \
+       bar_trivial.vgtest bar_trivial.stdout.exp \
+               bar_trivial.stderr.exp-glibc28-amd64 \
        hg01_all_ok.vgtest hg01_all_ok.stdout.exp \
                hg01_all_ok.stderr.exp-glibc25-amd64 \
        hg02_deadlock.vgtest hg02_deadlock.stdout.exp \
@@ -21,6 +25,12 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
                hg05_race2.stderr.exp-glibc25-x86 \
        hg06_readshared.vgtest hg06_readshared.stdout.exp \
                hg06_readshared.stderr.exp-glibc25-amd64 \
+       pth_barrier1.vgtest pth_barrier1.stdout.exp \
+               pth_barrier1.stderr.exp-glibc28-amd64 \
+       pth_barrier2.vgtest pth_barrier2.stdout.exp \
+               pth_barrier2.stderr.exp-glibc28-amd64 \
+       pth_barrier3.vgtest pth_barrier3.stdout.exp \
+               pth_barrier3.stderr.exp-glibc28-amd64 \
        rwlock_race.vgtest rwlock_race.stdout.exp \
                rwlock_race.stderr.exp-glibc25-amd64 \
        rwlock_test.vgtest rwlock_test.stdout.exp \
@@ -93,12 +103,15 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
                tc24_nonzero_sem.stderr.exp-glibc25-amd64
 
 check_PROGRAMS = \
+       bar_bad \
+       bar_trivial \
        hg01_all_ok \
        hg02_deadlock \
        hg03_inherit \
        hg04_race \
        hg05_race2 \
        hg06_readshared \
+       pth_barrier \
        rwlock_race \
        rwlock_test \
        tc01_simple_race \
@@ -135,5 +148,6 @@ AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 LDADD          = -lpthread
 
 # only needed because of referencing sources in drd/tests
+pth_barrier_SOURCES    = ../../drd/tests/pth_barrier.c
 rwlock_race_SOURCES    = ../../drd/tests/rwlock_race.c
 rwlock_test_SOURCES    = ../../drd/tests/rwlock_test.c
diff --git a/helgrind/tests/bar_bad.c b/helgrind/tests/bar_bad.c
new file mode 100644 (file)
index 0000000..0258acf
--- /dev/null
@@ -0,0 +1,89 @@
+
+/* This program checks that Helgrind reports the five degenerate
+   uses of the barrier functions shown. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <unistd.h>
+#include <string.h>
+
+void* child1 ( void* arg )
+{
+   pthread_barrier_wait( (pthread_barrier_t*)arg );
+   return NULL;
+}
+
+int main ( void )
+{
+  pthread_barrier_t *bar1, *bar2, *bar3, *bar4, *bar5;
+  pthread_t thr1, thr2;
+  int r;
+
+  /* possibly set up a watchdog timer thread here. */
+
+
+
+
+
+
+
+
+
+
+
+  /* initialise a barrier with a zero count */
+  fprintf(stderr, "\ninitialise a barrier with zero count\n");
+  bar1 = malloc(sizeof(pthread_barrier_t));
+  pthread_barrier_init(bar1, NULL, 0);
+
+  /* initialise a barrier twice */
+  fprintf(stderr, "\ninitialise a barrier twice\n");
+  bar2 = malloc(sizeof(pthread_barrier_t));
+  pthread_barrier_init(bar2, NULL, 1);
+  pthread_barrier_init(bar2, NULL, 1);
+
+  /* initialise a barrier which has threads waiting on it.
+     This isn't too simple. */
+  fprintf(stderr, "\ninitialise a barrier which has threads waiting on it\n");
+  bar3 = malloc(sizeof(pthread_barrier_t));
+  pthread_barrier_init(bar3, NULL, 2);
+  /* create a thread, whose only purpose is to block on the barrier */
+  pthread_create(&thr1, NULL, child1, (void*)bar3);
+  /* guarantee that it gets there first */
+  sleep(1);
+  /* and now reinitialise */
+  pthread_barrier_init(bar3, NULL, 3);
+
+  /* destroy a barrier that has threads waiting at it */
+  fprintf(stderr, "\ndestroy a barrier that has waiting threads\n");
+  /* once again, create a thread, whose only purpose is to block. */
+  bar4 = malloc(sizeof(pthread_barrier_t));
+  pthread_barrier_init(bar4, NULL, 2);
+  /* create a thread, whose only purpose is to block on the barrier */
+  pthread_create(&thr2, NULL, child1, (void*)bar4);
+  /* guarantee that it gets there first */
+  sleep(1);
+  /* and now destroy */
+  pthread_barrier_destroy(bar4);
+
+  /* destroy a barrier that was never initialised.  This is a bit
+     tricky, in that we have to fill the barrier with bytes which
+     ensure that the pthread_barrier_destroy call doesn't hang for
+     some reason.  Zero-fill seems to work ok on amd64-linux (glibc
+     2.8). */
+  fprintf(stderr, "\ndestroy a barrier that was never initialised\n");
+  bar5 = malloc(sizeof(pthread_barrier_t));
+  assert(bar5);
+  memset(bar5, 0, sizeof(*bar5));
+  pthread_barrier_destroy(bar5);
+
+  /* now we need to clean up the mess .. */
+  r= pthread_cancel(thr1); assert(!r);
+  r= pthread_cancel(thr2); assert(!r);
+
+  free(bar1); free(bar2); free(bar3); free(bar4); free(bar5);
+
+  return 0;
+}
diff --git a/helgrind/tests/bar_bad.stderr.exp-glibc28-amd64 b/helgrind/tests/bar_bad.stderr.exp-glibc28-amd64
new file mode 100644 (file)
index 0000000..65342af
--- /dev/null
@@ -0,0 +1,45 @@
+
+initialise a barrier with zero count
+Thread #1 is the program's root thread
+
+Thread #1: pthread_barrier_init: 'count' argument is zero
+   at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:39)
+
+Thread #1's call to pthread_barrier_init failed
+   with error code 22 (EINVAL: Invalid argument)
+   at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:39)
+
+initialise a barrier twice
+
+Thread #1: pthread_barrier_init: barrier is already initialised
+   at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:45)
+
+initialise a barrier which has threads waiting on it
+
+Thread #1: pthread_barrier_init: barrier is already initialised
+   at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:57)
+
+Thread #1: pthread_barrier_init: threads are waiting at barrier
+   at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:57)
+
+destroy a barrier that has waiting threads
+
+Thread #1: pthread_barrier_destroy: threads are waiting at barrier
+   at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:69)
+
+Thread #1's call to pthread_barrier_destroy failed
+   with error code 16 (EBUSY: Device or resource busy)
+   at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:69)
+
+destroy a barrier that was never initialised
+
+Thread #1: pthread_barrier_destroy: barrier was never initialised
+   at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+   by 0x........: main (bar_bad.c:80)
diff --git a/helgrind/tests/bar_bad.stdout.exp b/helgrind/tests/bar_bad.stdout.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/bar_bad.vgtest b/helgrind/tests/bar_bad.vgtest
new file mode 100644 (file)
index 0000000..8333faa
--- /dev/null
@@ -0,0 +1,2 @@
+prog: bar_bad
+vgopts: -q
diff --git a/helgrind/tests/bar_trivial.c b/helgrind/tests/bar_trivial.c
new file mode 100644 (file)
index 0000000..8d77034
--- /dev/null
@@ -0,0 +1,57 @@
+
+/* This is the most trivial test I could think of that involves
+   barriers.  If H fails to notice the pthread_barrier_wait call then
+   it will report a race.  Correct behaviour is not to report a race
+   (there isn't one.) */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <unistd.h>
+
+int x = 0;
+
+pthread_barrier_t bar;
+
+void* child_fn ( void* arg )
+{
+   long r, n = (long)arg;
+
+   if (n == 1) x++;
+
+   r = pthread_barrier_wait(&bar); 
+   assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
+
+   if (n == 0) x++;
+
+   sleep(1); /* ensure both threads get to this point before
+                either exits. */
+   return NULL;
+}
+
+#define NTHR 2
+
+int main ( void )
+{
+   long i, r;
+   pthread_t thr[NTHR];
+
+   r = pthread_barrier_init(&bar, NULL, NTHR);
+   assert(!r);
+
+   for (i = 0; i < NTHR; i++) {
+      r = pthread_create(&thr[i], NULL, child_fn, (void*)i);
+      assert(!r);
+   }
+
+   for (i = 0; i < NTHR; i++) {
+      r = pthread_join(thr[i], NULL);
+      assert(!r);
+   }
+
+   r = pthread_barrier_destroy(&bar); assert(!r);
+
+   printf("x = %d\n", x);
+   return 0;
+}
diff --git a/helgrind/tests/bar_trivial.stderr.exp-glibc28-amd64 b/helgrind/tests/bar_trivial.stderr.exp-glibc28-amd64
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/bar_trivial.stdout.exp b/helgrind/tests/bar_trivial.stdout.exp
new file mode 100644 (file)
index 0000000..407de30
--- /dev/null
@@ -0,0 +1 @@
+x = 2
diff --git a/helgrind/tests/bar_trivial.vgtest b/helgrind/tests/bar_trivial.vgtest
new file mode 100644 (file)
index 0000000..58e85b1
--- /dev/null
@@ -0,0 +1,2 @@
+prog: bar_trivial
+vgopts: -q
diff --git a/helgrind/tests/filter_threadnums b/helgrind/tests/filter_threadnums
new file mode 100755 (executable)
index 0000000..4312d20
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+./filter_stderr |
+
+# get rid of the numbers in bits of text "Thread #n" and "thread #n"
+# as these make some tests more scheduling sensitive -- those where
+# there are multiple threads which play interchangeable roles.
+
+sed "s/hread #[0-9]*/hread #x/"
diff --git a/helgrind/tests/pth_barrier1.stderr.exp-glibc28-amd64 b/helgrind/tests/pth_barrier1.stderr.exp-glibc28-amd64
new file mode 100644 (file)
index 0000000..bfc431e
--- /dev/null
@@ -0,0 +1,26 @@
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
diff --git a/helgrind/tests/pth_barrier1.stdout.exp b/helgrind/tests/pth_barrier1.stdout.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/pth_barrier1.vgtest b/helgrind/tests/pth_barrier1.vgtest
new file mode 100644 (file)
index 0000000..2896fa6
--- /dev/null
@@ -0,0 +1,4 @@
+prog: pth_barrier
+args: 2 1 1
+vgopts: -q
+stderr_filter: ./filter_threadnums
diff --git a/helgrind/tests/pth_barrier2.stderr.exp-glibc28-amd64 b/helgrind/tests/pth_barrier2.stderr.exp-glibc28-amd64
new file mode 100644 (file)
index 0000000..4f979a3
--- /dev/null
@@ -0,0 +1,367 @@
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
diff --git a/helgrind/tests/pth_barrier2.stdout.exp b/helgrind/tests/pth_barrier2.stdout.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/pth_barrier2.vgtest b/helgrind/tests/pth_barrier2.vgtest
new file mode 100644 (file)
index 0000000..ebe0fda
--- /dev/null
@@ -0,0 +1,4 @@
+prog: pth_barrier
+args: 2 32 1
+vgopts: -q --cmp-race-err-addrs=yes
+stderr_filter: ./filter_threadnums
diff --git a/helgrind/tests/pth_barrier3.stderr.exp-glibc28-amd64 b/helgrind/tests/pth_barrier3.stderr.exp-glibc28-amd64
new file mode 100644 (file)
index 0000000..bfc431e
--- /dev/null
@@ -0,0 +1,26 @@
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Thread #x was created
+   at 0x........: clone (in /...libc...)
+   by 0x........: ...
+   by 0x........: pthread_create@GLIBC_ (in /lib/libpthread...)
+   by 0x........: pthread_create@* (hg_intercepts.c:...)
+   by 0x........: barriers_and_races (pth_barrier.c:84)
+   by 0x........: main (pth_barrier.c:107)
+
+Possible data race during write of size 4 at 0x........ by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
+ This conflicts with a previous access by thread #x
+   at 0x........: threadfunc (pth_barrier.c:57)
+   by 0x........: mythread_wrapper (hg_intercepts.c:...)
+   by 0x........: ...
+   by 0x........: ...
diff --git a/helgrind/tests/pth_barrier3.stdout.exp b/helgrind/tests/pth_barrier3.stdout.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/helgrind/tests/pth_barrier3.vgtest b/helgrind/tests/pth_barrier3.vgtest
new file mode 100644 (file)
index 0000000..bdb9e6d
--- /dev/null
@@ -0,0 +1,4 @@
+prog: pth_barrier
+args: 32 1 1
+vgopts: -q
+stderr_filter: ./filter_threadnums