<commit_before># Test target to run Python test suite from main build.

add_custom_target(check-clang-python
    COMMAND ${CMAKE_COMMAND} -E env
            CLANG_LIBRARY_PATH=$<TARGET_FILE_DIR:libclang>
            ${PYTHON_EXECUTABLE} -m unittest discover
    DEPENDS libclang
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)

# Tests fail on Windows, and need someone knowledgeable to fix.
# It's not clear whether it's a test or a valid binding problem.
if(NOT WIN32)
    set_property(GLOBAL APPEND PROPERTY
                 LLVM_ADDITIONAL_TEST_TARGETS check-clang-python)
endif()<commit_msg>[python] [tests] Disable python binding tests under LLVM_USE_SANITIZER=Address<commit_after># Test target to run Python test suite from main build.

add_custom_target(check-clang-python
    COMMAND ${CMAKE_COMMAND} -E env
            CLANG_LIBRARY_PATH=$<TARGET_FILE_DIR:libclang>
            ${PYTHON_EXECUTABLE} -m unittest discover
    DEPENDS libclang
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)

# Check if we are building with ASan
list(FIND LLVM_USE_SANITIZER "Address" LLVM_USE_ASAN_INDEX)
if (LLVM_USE_ASAN_INDEX EQUAL -1)
  set(LLVM_USE_ASAN FALSE)
else()
  set(LLVM_USE_ASAN TRUE)
endif()

# Tests fail on Windows, and need someone knowledgeable to fix.
# It's not clear whether it's a test or a valid binding problem.
#
# Do not try to run if libclang was built with ASan because
# the sanitizer library will likely be loaded too late to perform
# interception and will then fail.
# We could use LD_PRELOAD/DYLD_INSERT_LIBRARIES but this isn't
# portable so its easier just to not run the tests when building
# with ASan.
if((NOT WIN32) AND (NOT LLVM_USE_ASAN))
    set_property(GLOBAL APPEND PROPERTY
                 LLVM_ADDITIONAL_TEST_TARGETS check-clang-python)
endif()
{'fraction_non_alphanumeric': 0.0678154530294608, 'fraction_numerical': 0.0027793218454697055, 'mean_word_length': 4.113636363636363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7642139', 'n_tokens_mistral': 601, 'n_tokens_neox': 577, 'n_words': 189}