brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · a2e4c8c Raw
127 lines · plain
1# Needed for lit support in standalone builds.2include(AddLLVM)3 4pythonize_bool(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)5 6pythonize_bool(LLVM_ENABLE_EXPENSIVE_CHECKS)7 8pythonize_bool(ZLIB_FOUND)9pythonize_bool(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC)10 11pythonize_bool(COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)12 13pythonize_bool(SANITIZER_DISABLE_SYMBOLIZER_PATH_SEARCH)14 15pythonize_bool(COMPILER_RT_HAS_AARCH64_SME)16 17pythonize_bool(COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG)18 19configure_compiler_rt_lit_site_cfg(20  ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in21  ${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)22 23# BlocksRuntime (and most of builtins) testsuites are not yet ported to lit.24# add_subdirectory(BlocksRuntime)25 26set(SANITIZER_COMMON_LIT_TEST_DEPS)27 28if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)29  list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)30endif()31 32# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),33# and run tests with tools from the host toolchain.34if(NOT ANDROID)35  if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT LLVM_RUNTIMES_BUILD)36    # Use LLVM utils and Clang from the same build tree.37    list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS38      clang clang-resource-headers FileCheck count not llvm-config llvm-nm 39      llvm-objdump llvm-readelf llvm-readobj llvm-size llvm-symbolizer 40      compiler-rt-headers sancov split-file llvm-strip)41    if (WIN32)42      list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)43    endif()44  endif()45  # Tests use C++ standard library headers.46  if (TARGET cxx-headers OR HAVE_LIBCXX)47    list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS cxx-headers)48  endif()49endif()50 51umbrella_lit_testsuite_begin(check-compiler-rt)52 53function(compiler_rt_test_runtime runtime)54  string(TOUPPER ${runtime} runtime_uppercase)55  if(COMPILER_RT_HAS_${runtime_uppercase} AND COMPILER_RT_INCLUDE_TESTS)56    if (${runtime} STREQUAL cfi AND NOT COMPILER_RT_HAS_UBSAN)57      # CFI tests require diagnostic mode, which is implemented in UBSan.58    elseif (${runtime} STREQUAL scudo_standalone)59      add_subdirectory(scudo/standalone)60    else()61      add_subdirectory(${runtime})62    endif()63  endif()64endfunction()65 66# Run sanitizer tests only if we're sure that clang would produce67# working binaries.68if(COMPILER_RT_CAN_EXECUTE_TESTS)69  if(COMPILER_RT_BUILD_BUILTINS)70    add_subdirectory(builtins)71  endif()72  if(COMPILER_RT_BUILD_SANITIZERS)73    compiler_rt_test_runtime(interception)74 75    compiler_rt_test_runtime(lsan)76    compiler_rt_test_runtime(ubsan)77    compiler_rt_test_runtime(sanitizer_common)78 79    # OpenBSD not supporting asan, cannot run the tests80    if(COMPILER_RT_BUILD_LIBFUZZER AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD" AND NOT ANDROID)81      compiler_rt_test_runtime(fuzzer)82 83      # These tests don't need an additional runtime but use asan runtime.84      add_subdirectory(metadata)85    endif()86 87    foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})88      compiler_rt_test_runtime(${sanitizer})89    endforeach()90  endif()91  if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)92    compiler_rt_test_runtime(profile)93  endif()94  if(COMPILER_RT_BUILD_CTX_PROFILE)95    compiler_rt_test_runtime(ctx_profile)96  endif()97  if(COMPILER_RT_BUILD_MEMPROF)98    compiler_rt_test_runtime(memprof)99  endif()100  if(COMPILER_RT_BUILD_XRAY)101    compiler_rt_test_runtime(xray)102  endif()103  if(COMPILER_RT_BUILD_ORC)104    compiler_rt_test_runtime(orc)105  endif()106  # ShadowCallStack does not yet provide a runtime with compiler-rt, the tests107  # include their own minimal runtime108  add_subdirectory(shadowcallstack)109endif()110 111# Now that we've traversed all the directories and know all the lit testsuites,112# introduce a rule to run to run all of them.113get_property(LLVM_COMPILER_RT_LIT_DEPENDS GLOBAL PROPERTY LLVM_COMPILER_RT_LIT_DEPENDS)114add_custom_target(compiler-rt-test-depends)115set_target_properties(compiler-rt-test-depends PROPERTIES FOLDER "Compiler-RT/Tests")116if(LLVM_COMPILER_RT_LIT_DEPENDS)117  add_dependencies(compiler-rt-test-depends ${LLVM_COMPILER_RT_LIT_DEPENDS})118endif()119umbrella_lit_testsuite_end(check-compiler-rt)120 121if(COMPILER_RT_STANDALONE_BUILD)122  if(NOT TARGET check-all)123    add_custom_target(check-all)124  endif()125  add_dependencies(check-all check-compiler-rt)126endif()127