CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
98 lines
3.3 KiB
Python
98 lines
3.3 KiB
Python
# -*- Python -*-
|
|
|
|
import os
|
|
|
|
|
|
def get_required_attr(config, attr_name):
|
|
attr_value = getattr(config, attr_name, None)
|
|
if attr_value is 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.py " % attr_name
|
|
)
|
|
return attr_value
|
|
|
|
|
|
# Setup config name.
|
|
config.name = "UBSan-" + config.name_suffix
|
|
|
|
# Setup source root.
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
default_ubsan_opts = list(config.default_sanitizer_opts)
|
|
# Choose between standalone and UBSan+ASan modes.
|
|
ubsan_lit_test_mode = get_required_attr(config, "ubsan_lit_test_mode")
|
|
if ubsan_lit_test_mode == "Standalone":
|
|
config.available_features.add("ubsan-standalone")
|
|
clang_ubsan_cflags = []
|
|
elif ubsan_lit_test_mode == "StandaloneStatic":
|
|
config.available_features.add("ubsan-standalone-static")
|
|
clang_ubsan_cflags = ["-static-libsan"]
|
|
elif ubsan_lit_test_mode == "AddressSanitizer":
|
|
config.available_features.add("ubsan-asan")
|
|
clang_ubsan_cflags = ["-fsanitize=address"]
|
|
default_ubsan_opts += ["detect_leaks=0"]
|
|
elif ubsan_lit_test_mode == "MemorySanitizer":
|
|
config.available_features.add("ubsan-msan")
|
|
clang_ubsan_cflags = ["-fsanitize=memory"]
|
|
elif ubsan_lit_test_mode == "ThreadSanitizer":
|
|
config.available_features.add("ubsan-tsan")
|
|
clang_ubsan_cflags = ["-fsanitize=thread"]
|
|
elif ubsan_lit_test_mode == "TypeSanitizer":
|
|
config.available_features.add("ubsan-tysan")
|
|
clang_ubsan_cflags = ["-fsanitize=type"]
|
|
else:
|
|
lit_config.fatal("Unknown UBSan test mode: %r" % ubsan_lit_test_mode)
|
|
|
|
# Platform-specific default for lit tests.
|
|
if config.target_arch == "s390x":
|
|
# On SystemZ we need -mbackchain to make the fast unwinder work.
|
|
clang_ubsan_cflags.append("-mbackchain")
|
|
|
|
default_ubsan_opts_str = ":".join(default_ubsan_opts)
|
|
if default_ubsan_opts_str:
|
|
config.environment["UBSAN_OPTIONS"] = default_ubsan_opts_str
|
|
default_ubsan_opts_str += ":"
|
|
# Substitution to setup UBSAN_OPTIONS in portable way.
|
|
config.substitutions.append(
|
|
("%env_ubsan_opts=", "env UBSAN_OPTIONS=" + default_ubsan_opts_str)
|
|
)
|
|
|
|
|
|
def build_invocation(compile_flags):
|
|
return " " + " ".join([config.clang] + compile_flags) + " "
|
|
|
|
|
|
target_cflags = [get_required_attr(config, "target_cflags")]
|
|
clang_ubsan_cflags += 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)))
|
|
config.substitutions.append(("%gmlt ", " ".join(config.debug_info_flags) + " "))
|
|
|
|
# Default test suffixes.
|
|
config.suffixes = [".c", ".cpp", ".m"]
|
|
|
|
# Check that the host supports UndefinedBehaviorSanitizer tests
|
|
if config.target_os not in [
|
|
"Linux",
|
|
"Darwin",
|
|
"FreeBSD",
|
|
"Windows",
|
|
"NetBSD",
|
|
"SunOS",
|
|
"OpenBSD",
|
|
]:
|
|
config.unsupported = True
|
|
|
|
config.excludes = ["Inputs"]
|
|
|
|
if ubsan_lit_test_mode in ["AddressSanitizer", "MemorySanitizer", "ThreadSanitizer"]:
|
|
if not config.parallelism_group:
|
|
config.parallelism_group = "shadow-memory"
|
|
if config.target_os == "NetBSD":
|
|
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))
|