1config.name = "NSan" + config.name_suffix 2 3# Setup source root. 4config.test_source_root = os.path.dirname(__file__) 5 6# Test suffixes. 7config.suffixes = [".c", ".cpp", ".test"] 8 9# C & CXX flags. 10c_flags = [config.target_cflags] 11 12# CXX flags 13cxx_flags = c_flags + config.cxx_mode_flags + ["-std=c++17"] 14 15nsan_flags = [ 16 "-fsanitize=numerical", 17 "-g", 18 "-mno-omit-leaf-frame-pointer", 19 "-fno-omit-frame-pointer", 20] 21 22 23def build_invocation(compile_flags): 24 return " " + " ".join([config.clang] + compile_flags) + " " 25 26 27# Add substitutions. 28config.substitutions.append(("%clang ", build_invocation(c_flags))) 29config.substitutions.append(("%clang_nsan ", build_invocation(c_flags + nsan_flags))) 30config.substitutions.append( 31 ("%clangxx_nsan ", build_invocation(cxx_flags + nsan_flags)) 32) 33 34# NSan tests are currently supported on Linux only. 35if config.host_os not in ["Linux"]: 36 config.unsupported = True 37