[Sanitizer] Use generic configs for running sanitizer_common unit tests

llvm-svn: 190276
This commit is contained in:
Alexey Samsonov 2013-09-08 13:52:07 +00:00
parent bd25241e0e
commit a302a1affc
2 changed files with 9 additions and 40 deletions

View File

@ -1,29 +0,0 @@
# -*- Python -*-
import os
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
if not attr_value:
lit_config.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.
compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
"lit.common.unit.cfg")
lit_config.load_config(config, compiler_rt_lit_unit_cfg)
# Setup config name.
config.name = 'SanitizerCommon-Unit'
# Setup test source and exec root. For unit tests, we define
# it as build directory with sanitizer_common unit tests.
llvm_obj_root = get_required_attr(config, "llvm_obj_root")
config.test_exec_root = os.path.join(llvm_obj_root, "projects",
"compiler-rt", "lib",
"sanitizer_common", "tests")
config.test_source_root = config.test_exec_root

View File

@ -1,16 +1,14 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
# Load common config for all compiler-rt unit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/lib/lit.common.unit.configured")
try:
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
except KeyError,e:
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
# Setup config name.
config.name = 'SanitizerCommon-Unit'
# Let the main config do the real work.
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
# Setup test source and exec root. For unit tests, we define
# it as build directory with sanitizer_common tests.
config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@", "lib",
"sanitizer_common", "tests")
config.test_source_root = config.test_exec_root