Update valgrind-3.11.0-pthread_barrier.patch

This commit is contained in:
Mark Wielaard 2016-01-21 15:57:58 +01:00
parent 120af06c15
commit e420d8e4a7

View File

@ -1,38 +1,41 @@
From b6a0f7b1c175a0159909ede7b41fae09c247784e Mon Sep 17 00:00:00 2001 commit f4d91a5df8b749c6cdfec25e38a44c02c90ad4be
From: Mark Wielaard <mjw@redhat.com> Author: Mark Wielaard <mjw@redhat.com>
Date: Tue, 19 Jan 2016 15:13:47 +0100 Date: Tue Jan 19 15:13:47 2016 +0100
Subject: [PATCH] pthread_barrier vs newer glibc implementation
glibc 2.23 will have a new pthread_barrier implementation. Bug #358213 helgrind/drd pthread_barrier tests vs new glibc implementation
This implementation reacts differently on bad usage of barriers.
Because of this the bar_bad testcase will hang indefinitely.
In particular pthread_barrier_destroy will hang when there are
still other threads waiting on a barrier. To solve this we add
extra threads to will "unblock" the hanging destroy by sleeping
for a while and then also waiting on the barrier, which will unblock
the destroy operation. Or if this is the last test, just exit
the whole program since we are done anyway. Also newer glibc is
more picky about destroying uninitialized barriers, we would crash
when zero filling, so we now one fill. Which doesn't crash, but
depending on glibc version might return an error or hang. Since
depending on version we now get slightly different error reports
there are now alternative exp files.
Tested against glibc 2.17, glibc 2.22 and glibc 2.23-prerelease. glibc 2.23 will have a new pthread_barrier implementation.
--- This implementation reacts differently on bad usage of barriers.
drd/tests/bar_bad.stderr.exp | 13 +--- Because of this the bar_bad testcase will hang indefinitely.
...ar_bad.stderr.exp => bar_bad.stderr.exp-nohang} | 9 +-- In particular pthread_barrier_destroy will hang when there are
drd/tests/bar_bad_xml.stderr.exp | 80 ---------------------- still other threads waiting on a barrier. To solve this we add
...ml.stderr.exp => bar_bad_xml.stderr.exp-nohang} | 51 -------------- extra threads to will "unblock" the hanging destroy by sleeping
helgrind/tests/Makefile.am | 1 + for a while and then also waiting on the barrier, which will unblock
helgrind/tests/bar_bad.c | 51 +++++++++----- the destroy operation. Or if this is the last test, just exit
helgrind/tests/bar_bad.stderr.exp | 16 ++--- the whole program since we are done anyway. Also newer glibc is
....stderr.exp => bar_bad.stderr.exp-destroy-hang} | 30 +++++--- more picky about destroying uninitialized barriers, we would crash
8 files changed, 64 insertions(+), 187 deletions(-) when zero filling, so we now one fill. Which doesn't crash, but
copy drd/tests/{bar_bad.stderr.exp => bar_bad.stderr.exp-nohang} (79%) depending on glibc version might return an error or hang. Since
copy drd/tests/{bar_bad_xml.stderr.exp => bar_bad_xml.stderr.exp-nohang} (82%) depending on version we now get slightly different error reports
copy helgrind/tests/{bar_bad.stderr.exp => bar_bad.stderr.exp-destroy-hang} (72%) there are now alternative exp files.
Tested against glibc 2.17, glibc 2.22 and glibc 2.23-prerelease.
diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am
index 2885391..cfd74d0 100644
--- a/drd/tests/Makefile.am
+++ b/drd/tests/Makefile.am
@@ -81,8 +81,10 @@ EXTRA_DIST = \
atomic_var.stderr.exp \
atomic_var.vgtest \
bar_bad.stderr.exp \
+ bar_bad.stderr.exp-nohang \
bar_bad.vgtest \
bar_bad_xml.stderr.exp \
+ bar_bad_xml.stderr.exp-nohang \
bar_bad_xml.vgtest \
bar_trivial.stderr.exp \
bar_trivial.stdout.exp \
diff --git a/drd/tests/bar_bad.stderr.exp b/drd/tests/bar_bad.stderr.exp diff --git a/drd/tests/bar_bad.stderr.exp b/drd/tests/bar_bad.stderr.exp
index 75f121f..3581b08 100644 index 75f121f..3581b08 100644
--- a/drd/tests/bar_bad.stderr.exp --- a/drd/tests/bar_bad.stderr.exp
@ -508,6 +511,3 @@ index 74af4fa..ddf5624 100644
- by 0x........: main (bar_bad.c:80) - by 0x........: main (bar_bad.c:80)
+ by 0x........: main (bar_bad.c:96) + by 0x........: main (bar_bad.c:96)
--
1.8.3.1