Make (most of) Python's tests pass under Thread Sanitizer.

http://code.google.com/p/data-race-test/wiki/ThreadSanitizer is a dynamic data
race detector that runs on top of valgrind. With this patch, the binaries at
http://code.google.com/p/data-race-test/wiki/ThreadSanitizer#Binaries pass many
but not all of the Python tests. All of regrtest still passes outside of tsan.

I've implemented part of the C1x atomic types so that we can explicitly mark
variables that are used across threads, and get defined behavior as compilers
advance.

I've added tsan's client header and implementation to the codebase in
dynamic_annotations.{h,c} (docs at
http://code.google.com/p/data-race-test/wiki/DynamicAnnotations).
Unfortunately, I haven't been able to get helgrind and drd to give sensible
error messages, even when I use their client annotations, so I'm not supporting
them.
This commit is contained in:
Jeffrey Yasskin 2010-05-03 19:29:34 +00:00
parent 6be8876623
commit 39370830a9
17 changed files with 971 additions and 63 deletions

11
configure vendored
View file

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 80648 .
# From configure.in Revision: 80666 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for python 3.2.
#
@ -1929,11 +1929,11 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
enum { N = $2 / 2 - 1 };
int
main ()
{
static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
test_array [0] = 0
;
@ -1944,11 +1944,11 @@ if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
enum { N = $2 / 2 - 1 };
int
main ()
{
static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
< ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
test_array [0] = 0
@ -9210,6 +9210,7 @@ else
fi
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
# Check for --with-wctype-functions