diff options
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/lit.cfg')
-rw-r--r-- | compiler-rt/lib/asan/lit_tests/lit.cfg | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/lit.cfg b/compiler-rt/lib/asan/lit_tests/lit.cfg new file mode 100644 index 00000000000..28f51794cec --- /dev/null +++ b/compiler-rt/lib/asan/lit_tests/lit.cfg @@ -0,0 +1,46 @@ +# -*- Python -*- + +import os + +def get_required_attr(config, attr_name): + attr_value = getattr(config, attr_name, None) + if not attr_value: + lit.fatal("No attribute %r in test configuration! You may need to run " + "tests from your build directory or add this attribute " + "to lit.site.cfg " % attr_name) + return attr_value + +# Setup attributes common for all compiler-rt projects. +llvm_src_root = get_required_attr(config, 'llvm_src_root') +compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt", + "lib", "lit.common.cfg") +lit.load_config(config, compiler_rt_lit_cfg) + +# Setup config name. +config.name = 'AddressSanitizer' + +# Setup source root. +config.test_source_root = os.path.dirname(__file__) + +# Setup default compiler flags used with -faddress-sanitizer option. +# FIXME: Review the set of required flags and check if it can be reduced. +clang_asan_cxxflags = ("-faddress-sanitizer " + + "-mno-omit-leaf-frame-pointer " + + "-fno-omit-frame-pointer " + + "-fno-optimize-sibling-calls " + + "-g") +config.substitutions.append( ("%clang_asan ", (" " + config.clang + " " + + clang_asan_cxxflags + " ")) ) + +# Setup path to symbolizer script. +# FIXME: Instead we should copy this script to the build tree and point +# at it there. +asan_source_dir = os.path.join(config.test_source_root, "..") +symbolizer = os.path.join(asan_source_dir, + 'scripts', 'asan_symbolize.py') +if not os.path.exists(symbolizer): + lit.fatal("Can't find symbolizer script on path %r" % symbolizer) +config.substitutions.append( ('%symbolizer', (" " + symbolizer + " " ))) + +# Default test suffixes. +config.suffixes = ['.c', '.cc', '.cpp'] |