Peter Collingbourne 3fa07ed5b3
Rename config.host_os to config.target_os.
config.host_os is derived from CMAKE_SYSTEM_NAME
which specifies the target. See:
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html

To reduce confusion, rename it to config.target_os.

The variable name config.target_os was already being used by the Orc
tests. Rename it to config.orc_test_target_os with a FIXME to remove.

Reviewers: JDevlieghere, MaskRay

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/149015
2025-07-17 11:12:29 -07:00

37 lines
921 B
Python

config.name = "NSan" + config.name_suffix
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Test suffixes.
config.suffixes = [".c", ".cpp", ".test"]
# C & CXX flags.
c_flags = [config.target_cflags]
# CXX flags
cxx_flags = c_flags + config.cxx_mode_flags + ["-std=c++17"]
nsan_flags = [
"-fsanitize=numerical",
"-g",
"-mno-omit-leaf-frame-pointer",
"-fno-omit-frame-pointer",
]
def build_invocation(compile_flags):
return " " + " ".join([config.clang] + compile_flags) + " "
# Add substitutions.
config.substitutions.append(("%clang ", build_invocation(c_flags)))
config.substitutions.append(("%clang_nsan ", build_invocation(c_flags + nsan_flags)))
config.substitutions.append(
("%clangxx_nsan ", build_invocation(cxx_flags + nsan_flags))
)
# NSan tests are currently supported on Linux only.
if config.target_os not in ["Linux"]:
config.unsupported = True