<commit_before># -*- Python -*-

import os

def get_required_attr(config, attr_name):
  attr_value = getattr(config, attr_name, None)
  if attr_value == None:
    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 source root.
config.test_source_root = os.path.dirname(__file__)
config.name = 'UBSan-Minimal-' + config.target_arch

def build_invocation(compile_flags):
  return " " + " ".join([config.clang] + compile_flags) + " "

target_cflags = [get_required_attr(config, "target_cflags")]
clang_ubsan_cflags = ["-fsanitize-minimal-runtime"] + target_cflags
clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags

# Define %clang and %clangxx substitutions to use in test RUN lines.
config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )

# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']

# Check that the host supports UndefinedBehaviorSanitizerMinimal tests
if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin']: # TODO: Windows
  config.unsupported = True

# Don't target x86_64h if the test machine can't execute x86_64h binaries.
if '-arch x86_64h' in target_cflags and 'x86_64h' not in config.available_features:
  config.unsupported = True

config.available_features.add('arch=' + config.target_arch)<commit_msg>[ubsan] Support ubsan-minimal tests on Android.<commit_after># -*- Python -*-

import os

def get_required_attr(config, attr_name):
  attr_value = getattr(config, attr_name, None)
  if attr_value == None:
    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 source root.
config.test_source_root = os.path.dirname(__file__)
config.name = 'UBSan-Minimal-' + config.target_arch

def build_invocation(compile_flags):
  return " " + " ".join([config.compile_wrapper, config.clang] + compile_flags) + " "

target_cflags = [get_required_attr(config, "target_cflags")]
clang_ubsan_cflags = ["-fsanitize-minimal-runtime"] + target_cflags
clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags

# Define %clang and %clangxx substitutions to use in test RUN lines.
config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )

# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']

# Check that the host supports UndefinedBehaviorSanitizerMinimal tests
if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin']: # TODO: Windows
  config.unsupported = True

# Don't target x86_64h if the test machine can't execute x86_64h binaries.
if '-arch x86_64h' in target_cflags and 'x86_64h' not in config.available_features:
  config.unsupported = True

config.available_features.add('arch=' + config.target_arch)
{'fraction_non_alphanumeric': 0.11494252873563218, 'fraction_numerical': 0.010217113665389528, 'mean_word_length': 5.119140625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '908757', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1037, 'n_words': 265}