diff options
| author | Jan Korous <jkorous@apple.com> | 2019-10-08 02:26:17 +0000 |
|---|---|---|
| committer | Jan Korous <jkorous@apple.com> | 2019-10-08 02:26:17 +0000 |
| commit | d6609a404fecafe479be8a012b99e3f278f86275 (patch) | |
| tree | ae9a3c1549807cdd4ed153b86d0a413599dea61d | |
| parent | 54d767f508bbcbdafd57bdbfcc4036173c2708e8 (diff) | |
| download | bcm5719-llvm-d6609a404fecafe479be8a012b99e3f278f86275.tar.gz bcm5719-llvm-d6609a404fecafe479be8a012b99e3f278f86275.zip | |
[NFC] Fix ubsan-blacklist test
Restored original test and marked tests for VFS as unsupported on Windows.
llvm-svn: 374011
| -rw-r--r-- | clang/test/CodeGen/ubsan-blacklist-vfs.c | 38 | ||||
| -rw-r--r-- | clang/test/CodeGen/ubsan-blacklist.c | 11 |
2 files changed, 38 insertions, 11 deletions
diff --git a/clang/test/CodeGen/ubsan-blacklist-vfs.c b/clang/test/CodeGen/ubsan-blacklist-vfs.c new file mode 100644 index 00000000000..c076eec95a4 --- /dev/null +++ b/clang/test/CodeGen/ubsan-blacklist-vfs.c @@ -0,0 +1,38 @@ +// UNSUPPORTED: system-windows + +// Verify ubsan doesn't emit checks for blacklisted functions and files +// RUN: echo "fun:hash" > %t-func.blacklist +// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.blacklist + +// RUN: rm -f %t-vfsoverlay.yaml +// RUN: rm -f %t-nonexistent.blacklist +// RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml +// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%T/only-virtual-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC + +// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%T/invalid-virtual-file.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE +// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or directory + +// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID +// INVALID: nonexistent.blacklist': No such file or directory + +unsigned i; + +// DEFAULT: @hash +// FUNC: @hash +// FILE: @hash +unsigned hash() { +// DEFAULT: call {{.*}}void @__ubsan +// FUNC-NOT: call {{.*}}void @__ubsan +// FILE-NOT: call {{.*}}void @__ubsan + return i * 37; +} + +// DEFAULT: @add +// FUNC: @add +// FILE: @add +unsigned add() { +// DEFAULT: call {{.*}}void @__ubsan +// FUNC: call {{.*}}void @__ubsan +// FILE-NOT: call {{.*}}void @__ubsan + return i + 1; +} diff --git a/clang/test/CodeGen/ubsan-blacklist.c b/clang/test/CodeGen/ubsan-blacklist.c index 61d33c983e6..666003bd923 100644 --- a/clang/test/CodeGen/ubsan-blacklist.c +++ b/clang/test/CodeGen/ubsan-blacklist.c @@ -5,17 +5,6 @@ // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-func.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE -// RUN: rm -f %t-vfsoverlay.yaml -// RUN: rm -f %t-nonexistent.blacklist -// RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-blacklist-vfsoverlay.yaml | sed -e "s|@REAL_FILE@|%/t-func.blacklist|g" | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.blacklist|g" > %t-vfsoverlay.yaml -// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%T/only-virtual-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC - -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%T/invalid-virtual-file.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID-MAPPED-FILE -// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or directory - -// RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-blacklist=%t-nonexistent.blacklist -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID -// INVALID: nonexistent.blacklist': No such file or directory - unsigned i; // DEFAULT: @hash |

