From 31ed7185a13d2616a7d4ff09b238375a1aecefb7 Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Mon, 2 Nov 2015 07:56:22 -0500
Subject: [PATCH 1/5] whitespace

---
 mk/main.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/main.mk b/mk/main.mk
index c0b6093fa4c..293748ed3e3 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -184,7 +184,7 @@ include $(CFG_SRC_DIR)mk/platform.mk
 
 # Run the stage1/2 compilers under valgrind
 ifdef VALGRIND_COMPILE
-  CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
+  CFG_VALGRIND_COMPILE := $(CFG_VALGRIND)
 else
   CFG_VALGRIND_COMPILE :=
 endif

From 08efcee85832c38bf0b7e5f30f0c3c1fd5824e4b Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Mon, 2 Nov 2015 07:56:09 -0500
Subject: [PATCH 2/5] jemalloc: quarantine is fixed

---
 mk/main.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mk/main.mk b/mk/main.mk
index 293748ed3e3..9762b482ce9 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -111,8 +111,7 @@ CFG_RUSTC_FLAGS := $(RUSTFLAGS)
 CFG_GCCISH_CFLAGS :=
 CFG_GCCISH_LINK_FLAGS :=
 
-# Turn off broken quarantine (see jemalloc/jemalloc#161)
-CFG_JEMALLOC_FLAGS := --disable-fill
+CFG_JEMALLOC_FLAGS :=
 
 ifdef CFG_DISABLE_OPTIMIZE
   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))

From 008f9d5822f181703387d867c29d8434968032d4 Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Mon, 2 Nov 2015 10:39:46 -0500
Subject: [PATCH 3/5] jemalloc: pass `--enable-valgrind` when valgrind is
 enabled

---
 mk/main.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mk/main.mk b/mk/main.mk
index 9762b482ce9..a5a4869ae9a 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -201,6 +201,7 @@ endif
 
 ifdef CFG_ENABLE_VALGRIND
   $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
+  CFG_JEMALLOC_FLAGS += --enable-valgrind
 else
   CFG_VALGRIND :=
 endif

From c21ffc27b12f092c8fd0789266aefff7796a73b5 Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Mon, 2 Nov 2015 11:19:27 -0500
Subject: [PATCH 4/5] print the unexpected character

---
 src/test/run-pass/atomic-print.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/run-pass/atomic-print.rs b/src/test/run-pass/atomic-print.rs
index ae0a358ac4e..aa1ef2025a0 100644
--- a/src/test/run-pass/atomic-print.rs
+++ b/src/test/run-pass/atomic-print.rs
@@ -41,7 +41,7 @@ fn main(){
             match line.chars().next().unwrap() {
                 '1' => assert_eq!(line, "11111"),
                 '2' => assert_eq!(line, "22222"),
-                _   => panic!("Unexpected character")
+                chr => panic!("unexpected character {:?}", chr)
             }
         }
     }

From 269a8111920b0d5faecd98d94d750608a6c09379 Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Sun, 1 Nov 2015 23:40:10 -0500
Subject: [PATCH 5/5] valgrind: update suppressions and move interesting tests

---
 src/etc/apple-darwin.supp                     | 104 +++-
 src/etc/x86.supp                              | 549 ++----------------
 .../down-with-thread-dtors.rs                 |   0
 .../exit-flushes.rs                           |   0
 .../osx-frameworks.rs                         |   0
 5 files changed, 159 insertions(+), 494 deletions(-)
 rename src/test/{run-pass => run-pass-valgrind}/down-with-thread-dtors.rs (100%)
 rename src/test/{run-pass => run-pass-valgrind}/exit-flushes.rs (100%)
 rename src/test/{run-pass => run-pass-valgrind}/osx-frameworks.rs (100%)

diff --git a/src/etc/apple-darwin.supp b/src/etc/apple-darwin.supp
index 7e2598f7694..866578930a3 100644
--- a/src/etc/apple-darwin.supp
+++ b/src/etc/apple-darwin.supp
@@ -1,9 +1,105 @@
 {
-   issue_1333_setenv_leak
+   osx-frameworks.rs-fails-otherwise-1
    Memcheck:Leak
+   match-leak-kinds: possible
+   fun:malloc
+   ...
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader19processInitializersERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE
+   fun:_ZN4dyld24initializeMainExecutableEv
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-2
+   Memcheck:Leak
+   match-leak-kinds: possible
+   fun:malloc_zone_calloc
+   ...
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader19processInitializersERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-3
+   Memcheck:Leak
+   match-leak-kinds: possible
+   fun:realloc
+   fun:_ZL12realizeClassP10objc_class
+   fun:_ZL12realizeClassP10objc_class
+   fun:_ZN13list_array_ttIm15protocol_list_tE11attachListsEPKPS0_j
+   fun:_read_images
+   fun:map_images_nolock
+   fun:map_2_images
+   fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
+   fun:_ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE
+   fun:dyld_register_image_state_change_handler
+   fun:_objc_init
+   fun:_os_object_init
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-4
+   Memcheck:Leak
+   match-leak-kinds: possible
+   fun:calloc
+   ...
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-5
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:calloc
+   ...
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-6
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:strdup
+   fun:_CFProcessPath
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader19processInitializersERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE
+   fun:_ZN4dyld24initializeMainExecutableEv
+   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_Pm
+}
+
+{
+   osx-frameworks.rs-fails-otherwise-7
+   Memcheck:Leak
+   match-leak-kinds: definite
    fun:malloc_zone_malloc
    ...
-   fun:setenv
-   fun:setenv__c_stack_shim
-   ...
+   fun:__CFInitialize
+   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
+   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader19processInitializersERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
+   fun:_ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE
+   fun:_ZN4dyld24initializeMainExecutableEv
 }
diff --git a/src/etc/x86.supp b/src/etc/x86.supp
index 58eb109d860..e4368da9033 100644
--- a/src/etc/x86.supp
+++ b/src/etc/x86.supp
@@ -1,496 +1,65 @@
-{
-   our-failure-to-setup-freeres-structure
-   Memcheck:Free
-   fun:free
-   fun:__libc_freeres
-   fun:_vgnU_freeres
-}
-
-{
-   our-failure-to-setup-freeres-structure2
-   Memcheck:Free
-   fun:free
-   fun:free_mem
-   fun:__libc_freeres
-   fun:_vgnU_freeres
-}
-
-{
- leaked-TLS-chunk-x86-exit-path-fails-to-clean-up
- Memcheck:Leak
- fun:calloc
- fun:_dl_allocate_tls
-}
-
-{
-   linux-dl-prob
-   Memcheck:Param
-   read(buf)
-   ...
-   fun:_dl_map_object
-}
-
-{
-   mac-dyld-oddity
-   Memcheck:Cond
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-   obj:*
-}
-
-{
-   mac-dlopen-weirdness
-   Memcheck:Cond
-   fun:_ZNK16ImageLoaderMachO9getRPathsERKN11ImageLoader11LinkContextERSt6vectorIPKcSaIS6_EE
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dlopen-weirdness-2
-   Memcheck:Value4
-   fun:_ZNK16ImageLoaderMachO9getRPathsERKN11ImageLoader11LinkContextERSt6vectorIPKcSaIS6_EE
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dlopen-weirdness-3
-   Memcheck:Value4
-   fun:strcpy
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dlopen-weirdness-4
-   Memcheck:Value4
-   obj:*
-   fun:_ZNK16ImageLoaderMachO9getRPathsERKN11ImageLoader11LinkContextERSt6vectorIPKcSaIS6_EE
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dlopen-weirdness-5
-   Memcheck:Cond
-   fun:memcpy
-   fun:strdup
-   fun:_ZNK16ImageLoaderMachO9getRPathsERKN11ImageLoader11LinkContextERSt6vectorIPKcSaIS6_EE
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dlopen-weirdness-6
-   Memcheck:Value4
-   fun:memcpy
-   fun:strdup
-   fun:_ZNK16ImageLoaderMachO9getRPathsERKN11ImageLoader11LinkContextERSt6vectorIPKcSaIS6_EE
-   fun:_ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE
-   fun:_ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:dlopen
-   fun:dlopen
-   fun:_ZN16rust_crate_cache3libC1EP8rust_domPKc
-   fun:_ZN16rust_crate_cache7get_libEmPKc
-   fun:_ZL11fetch_c_symP9rust_taskPK10rust_cratemmPKcS5_
-}
-
-{
-   mac-dyld
-   Memcheck:Cond
-   ...
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-   obj:*
-}
-
-{
-   mac-dyld-2
-   Memcheck:Value4
-   ...
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-   obj:*
-}
-
-{
-   mac-dyld-3
-   Memcheck:Param
-   stat(path)
-   ...
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-   obj:*
-}
-
-{
-   mac-dyld-4
-   Memcheck:Param
-   open(filename)
-   ...
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-   obj:*
-}
-
-{
-   mac-dyld-5
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld4loadEPKcRKNS_11LoadContextE
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-}
-
-{
-   mac-dyld-6
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld4loadEPKcRKNS_11LoadContextE
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-}
-
-{
-   mac-dyld-7
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld4loadEPKcRKNS_11LoadContextE
-}
-
-{
-   mac-dyld-8
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld4loadEPKcRKNS_11LoadContextE
-}
-
-{
-   mac-dyld-9
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyldL10loadPhase0EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE
-}
-
-{
-   mac-dyld-10
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyldL10loadPhase0EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE
-}
-
-{
-   mac-dyld-11
-   Memcheck:Param
-   stat(path)
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-}
-
-{
-   mac-dyld-12
-   Memcheck:Param
-   open(filename)
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-}
-
-{
-   mac-dyld-13
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-}
-
-{
-   mac-dyld-14
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-   fun:_dyld_start
-}
-
-{
-   mac-dyld-15
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-}
-
-{
-   mac-dyld-16
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-}
-
-{
-   mac-dyld-17
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
-}
-
-{
-   mac-dyld-18
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-   fun:_ZN13dyldbootstrap5startEPK12macho_headeriPPKcl
-}
-
-{
-   mac-dyld-19
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-}
-
-{
-   mac-dyld-20
-   Memcheck:Value4
-   ...
-   fun:_ZN4dyld24initializeMainExecutableEv
-}
-
-{
-   mac-dyld-21
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld24initializeMainExecutableEv
-   fun:_ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_
-}
-
-{
-   mac-dyld-22
-   Memcheck:Cond
-   ...
-   fun:_ZN4dyld24initializeMainExecutableEv
-}
-
-{
-   mac-dyld-23
-   Memcheck:Value4
-   ...
-   fun:_ZN11ImageLoader15runInitializersERKNS_11LinkContextE
-}
-
-{
-   mac-dyld-24
-   Memcheck:Cond
-   ...
-   fun:dyld_stub_binder_
-   fun:main
-}
-
-{
-   mac-dyld-25
-   Memcheck:Value4
-   ...
-   fun:dyld_stub_binder_
-   fun:main
-}
-
-{
-   mac-dyld-26
-   Memcheck:Cond
-   ...
-   fun:dyld_stub_binder_
-   ...
-}
-
-{
-   mac-dyld-27
-   Memcheck:Value4
-   ...
-   fun:dyld_stub_binder_
-   ...
-}
-
-{
-   mac-dyld-28
-   Memcheck:Cond
-   fun:_ZN4dyld14runTerminatorsEPv
-   ...
-}
-
-{
-   mac-dyld-29
-   Memcheck:Cond
-   fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
-   ...
-}
-
-{
-   mac-dyld-30
-   Memcheck:Value4
-   fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
-   ...
-}
-
-{
-   llvm-user-new-leak
-   Memcheck:Leak
-   fun:_Znwj
-   fun:_ZN4llvm4UsernwEjj
-}
-
-{
-   race-or-something-ask-pcwalton-0
-   Memcheck:Value4
-   fun:*task_start_wrapper*
-   ...
-}
-
-{
-   race-or-something-ask-pcwalton-1
-   Memcheck:Value4
-   ...
-   fun:*build_start_wrapper*
-   ...
-}
-
-{
-   lock_and_signal-probably-threadsafe-access-outside-of-lock
-   Helgrind:Race
-   fun:_ZN15lock_and_signal27lock_held_by_current_threadEv
-   ...
-}
-
-{
-   lock_and_signal-probably-threadsafe-access-outside-of-lock2
-   Helgrind:Race
-   fun:_ZN15lock_and_signal6unlockEv
-   ...
-}
-
-{
-   lock_and_signal-probably-threadsafe-access-outside-of-lock3
-   Helgrind:Race
-   fun:_ZN15lock_and_signal4lockEv
-   ...
-}
-
-{
-   lock_and_signal-probably-threadsafe-access-outside-of-lock4
-   Helgrind:Race
-   fun:_ZN15lock_and_signal4waitEv
-   ...
-}
-
-{
-   uv-async-send-does-racy-things
-   Helgrind:Race
-   fun:pipecb
-   fun:ev_invoke_pending
-   fun:ev_run
-   fun:uv_run
-   ...
-}
-
-{
-   uv-loop-init-does-some-checks-that-are-not-lock-protected
-   Helgrind:Race
-   fun:loop_init
-   fun:ev_loop_new
-   fun:uv_loop_new
-   ...
-}
-
-{
-   random-locking-order-but-it-only-happens-in-a-single-thread-at-a-time-I-polled-2-other-people-and-they-thought-it-was-prabably-ok
-   Helgrind:LockOrder
-   fun:pthread_mutex_lock
-   fun:_ZN15lock_and_signal4lockEv
-   fun:_ZN18rust_port_selector6selectEP9rust_taskPP9rust_portS4_mPm
-   ...
-}
-
-{
-   random-locking-order-but-it-only-happens-in-a-single-thread-at-a-time-I-polled-2-other-people-and-they-thought-it-was-prabably-ok
-   Helgrind:LockOrder
-   fun:pthread_mutex_lock
-   fun:pthread_mutex_lock
-   fun:_ZN15lock_and_signal4lockEv
-   fun:_ZN18rust_port_selector6selectEP9rust_taskPP9rust_portS4_mPm
-   ...
-}
-
-{
-   random-locking-order-but-it-only-happens-in-a-single-thread-at-a-time-I-polled-2-other-people-and-they-thought-it-was-prabably-ok-i686
-   Helgrind:LockOrder
-   fun:pthread_mutex_lock
-   fun:pthread_mutex_lock
-   fun:_ZN15lock_and_signal4lockEv
-   fun:_ZN18rust_port_selector6selectEP9rust_taskPP9rust_portS4_jPj
-}
-
-{
-   libunwind-surely-this-is-ok
-   Helgrind:Race
-   ...
-   fun:_Unwind_RaiseException
-   fun:__cxa_throw
-   ...
-}
-
-{
-   libunwind-surely-this-is-ok2
-   Helgrind:Race
-   ...
-   fun:_Unwind_Resume
-   ...
-}
-
-{
-   libunwind-surely-this-is-ok3
-   Helgrind:Race
-   fun:_Unwind_SetGR
-   fun:__gxx_personality_v0
-   ...
-}
-
 {
    goddammit-llvm-why-u-no-valgrind
    Memcheck:Cond
    fun:*
    ...
 }
+
+{
+   down-with-thread-dtors.rs-fails-otherwise-1
+   Memcheck:Addr1
+   ...
+   fun:tlv_finalize
+   fun:_pthread_tsd_cleanup
+   fun:_pthread_exit
+   fun:_pthread_body
+   fun:_pthread_start
+   fun:thread_start
+}
+
+{
+   down-with-thread-dtors.rs-fails-otherwise-2
+   Memcheck:Addr2
+   ...
+   fun:tlv_finalize
+   fun:_pthread_tsd_cleanup
+   fun:_pthread_exit
+   fun:_pthread_body
+   fun:_pthread_start
+   fun:thread_start
+}
+
+{
+   down-with-thread-dtors.rs-fails-otherwise-3
+   Memcheck:Addr4
+   ...
+   fun:tlv_finalize
+   fun:_pthread_tsd_cleanup
+   fun:_pthread_exit
+   fun:_pthread_body
+   fun:_pthread_start
+   fun:thread_start
+}
+
+{
+   down-with-thread-dtors.rs-fails-otherwise-4
+   Memcheck:Addr8
+   ...
+   fun:tlv_finalize
+   fun:_pthread_tsd_cleanup
+   fun:_pthread_exit
+   fun:_pthread_body
+   fun:_pthread_start
+   fun:thread_start
+}
+
+{
+   down-with-thread-dtors.rs-fails-otherwise-5
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:tlv_allocate_and_initialize_for_key
+   fun:tlv_get_addr
+   ...
+   fun:start
+}
diff --git a/src/test/run-pass/down-with-thread-dtors.rs b/src/test/run-pass-valgrind/down-with-thread-dtors.rs
similarity index 100%
rename from src/test/run-pass/down-with-thread-dtors.rs
rename to src/test/run-pass-valgrind/down-with-thread-dtors.rs
diff --git a/src/test/run-pass/exit-flushes.rs b/src/test/run-pass-valgrind/exit-flushes.rs
similarity index 100%
rename from src/test/run-pass/exit-flushes.rs
rename to src/test/run-pass-valgrind/exit-flushes.rs
diff --git a/src/test/run-pass/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs
similarity index 100%
rename from src/test/run-pass/osx-frameworks.rs
rename to src/test/run-pass-valgrind/osx-frameworks.rs