[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / lit.cfg
blob1e8c15d27442c8595f92d9d6237612f7774456e5
1 # -*- Python -*-
3 import os
5 def get_required_attr(config, attr_name):
6   attr_value = getattr(config, attr_name, None)
7   if not attr_value:
8     lit_config.fatal(
9       "No attribute %r in test configuration! You may need to run "
10       "tests from your build directory or add this attribute "
11       "to lit.site.cfg " % attr_name)
12   return attr_value
14 # Setup config name.
15 config.name = 'ThreadSanitizer'
17 # Setup source root.
18 config.test_source_root = os.path.dirname(__file__)
20 # Setup environment variables for running ThreadSanitizer.
21 tsan_options = "atexit_sleep_ms=0"
23 config.environment['TSAN_OPTIONS'] = tsan_options
25 # Setup default compiler flags used with -fsanitize=thread option.
26 # FIXME: Review the set of required flags and check if it can be reduced.
27 clang_tsan_cflags = ["-fsanitize=thread",
28                      "-g",
29                      "-Wall",
30                      "-lpthread",
31                      "-ldl",
32                      "-m64"]
33 clang_tsan_cxxflags = config.cxx_mode_flags + clang_tsan_cflags
35 def build_invocation(compile_flags):
36   return " " + " ".join([config.clang] + compile_flags) + " "
38 config.substitutions.append( ("%clang_tsan ", build_invocation(clang_tsan_cflags)) )
39 config.substitutions.append( ("%clangxx_tsan ", build_invocation(clang_tsan_cxxflags)) )
41 # Define CHECK-%os to check for OS-dependent output.
42 config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
44 # Default test suffixes.
45 config.suffixes = ['.c', '.cc', '.cpp']
47 # ThreadSanitizer tests are currently supported on Linux only.
48 if config.host_os not in ['Linux']:
49   config.unsupported = True