Skip to content

Commit

Permalink
Add support for tsan suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
milkie committed Mar 6, 2015
1 parent eb9785c commit a1ffa36
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1720,17 +1720,19 @@ def doConfigure(myenv):
print( 'sanitize is only supported with clang or gcc')
Exit(1)

if get_option('allocator') == 'tcmalloc':
# There are multiply defined symbols between the sanitizer and
# our vendorized tcmalloc.
print("Cannot use --sanitize with tcmalloc")
Exit(1)

sanitizer_list = get_option('sanitize').split(',')

using_lsan = 'leak' in sanitizer_list
using_asan = 'address' in sanitizer_list or using_lsan
using_tsan = 'thread' in sanitizer_list

if using_asan:
if get_option('allocator') == 'tcmalloc':
print("Cannot use address or leak sanitizer with tcmalloc")
Exit(1)

# If the user asked for leak sanitizer turn on the detect_leaks
# If the user asked for leak sanitizer, turn on the detect_leaks
# ASAN_OPTION. If they asked for address sanitizer as well, drop
# 'leak', because -fsanitize=leak means no address.
#
Expand Down Expand Up @@ -1779,10 +1781,15 @@ def doConfigure(myenv):
if llvm_symbolizer:
myenv['ENV']['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
myenv['ENV']['LSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
tsan_options = "external_symbolizer_path=\"%s\" " % llvm_symbolizer
elif using_lsan:
print("Using the leak sanitizer requires a valid symbolizer")
Exit(1)

if using_tsan:
tsan_options += "suppressions=\"%s\" " % myenv.File("#etc/tsan.suppressions").abspath
myenv['ENV']['TSAN_OPTIONS'] = tsan_options

if using_msvc() and optBuild:
# http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
#
Expand Down
1 change: 1 addition & 0 deletions etc/tsan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#

0 comments on commit a1ffa36

Please sign in to comment.