[ubsan_minimal] Introduce custom substitutions for clang with minimal runtime (#151613)
Make clang calls using custom suffix to allow correct calls without reading cfg.py. As I see tests for other other specific checks are doing it too (e.g. %clangxx_asan).
This commit is contained in:
parent
e15b3ef704
commit
f8a2ed7aac
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
// RUN: %clang_min_runtime -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang_min_runtime -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang_min_runtime -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
|
||||
// REQUIRES: lld-available, cfi
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -fsanitize=implicit-signed-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-signed-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clang -fsanitize=implicit-unsigned-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-unsigned-integer-truncation %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// RUN: %clangxx -fsanitize=local-bounds %s -O3 -o %t && %run %t 1
|
||||
// RUN: %clangxx -fsanitize=local-bounds %s -O3 -o %t && not --crash %run %t 3
|
||||
// RUN: %clangxx -fsanitize=local-bounds -fno-sanitize-trap=local-bounds %s -O3 -o %t && not --crash %run %t 3 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx -fsanitize=local-bounds -fno-sanitize-trap=local-bounds -fsanitize-recover=local-bounds %s -O3 -o %t && %run %t 3 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -fsanitize=local-bounds %s -O3 -o %t && %run %t 1
|
||||
// RUN: %clangxx_min_runtime -fsanitize=local-bounds %s -O3 -o %t && not --crash %run %t 3
|
||||
// RUN: %clangxx_min_runtime -fsanitize=local-bounds -fno-sanitize-trap=local-bounds %s -O3 -o %t && not --crash %run %t 3 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -fsanitize=local-bounds -fno-sanitize-trap=local-bounds -fsanitize-recover=local-bounds %s -O3 -o %t && %run %t 3 2>&1 | FileCheck %s
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// RUN: %clang -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
|
||||
// RUN: %clangxx -x c++ -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
|
||||
// RUN: %clang_min_runtime -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
|
||||
// RUN: %clangxx_min_runtime -x c++ -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="pointer-overflow"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all -DOVERRIDE=1 %s -o %t && not --crash %run %t 2>&1 | FileCheck %s --check-prefixes=FATAL
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clang_min_runtime -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=all -DOVERRIDE=1 %s -o %t && not --crash %run %t 2>&1 | FileCheck %s --check-prefixes=FATAL
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clangxx -fsanitize=signed-integer-overflow -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -fsanitize=signed-integer-overflow -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// RUN: %clangxx -w -fsanitize=signed-integer-overflow,nullability-return,returns-nonnull-attribute -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -w -fsanitize=signed-integer-overflow,nullability-return,returns-nonnull-attribute -fsanitize-recover=all %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
//
|
||||
// REQUIRES: x86_64-darwin
|
||||
|
||||
// RUN: nm -jgU `%clangxx -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
|
||||
// RUN: nm -jgU `%clangxx_min_runtime -fsanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_minimal_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_minimal_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
|
||||
// RUN: | sed 's/_minimal//g' \
|
||||
// RUN: > %t.minimal.symlist
|
||||
//
|
||||
// RUN: nm -jgU `%clangxx -fno-sanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
|
||||
// RUN: nm -jgU `%clangxx_min_runtime -fno-sanitize-minimal-runtime -fsanitize=undefined %s -o %t '-###' 2>&1 | grep "libclang_rt.ubsan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.ubsan_osx_dynamic.dylib\)".*/\1/'` | grep "^___ubsan_handle" \
|
||||
// RUN: | grep -vE "^___ubsan_handle_dynamic_type_cache_miss" \
|
||||
// RUN: | grep -vE "^___ubsan_handle_cfi_bad_type" \
|
||||
// RUN: | sed 's/_v1//g' \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx_min_runtime -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@ -27,9 +27,13 @@ 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)))
|
||||
# Define %clang_min_runtime and %clangxx_min_runtime substitutions to use in test RUN lines.
|
||||
config.substitutions.append(
|
||||
("%clang_min_runtime ", build_invocation(clang_ubsan_cflags))
|
||||
)
|
||||
config.substitutions.append(
|
||||
("%clangxx_min_runtime ", build_invocation(clang_ubsan_cxxflags))
|
||||
)
|
||||
|
||||
# Default test suffixes.
|
||||
config.suffixes = [".c", ".cpp"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user