Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit d798a1e

Browse files
committed
[NFC] Fix ubsan-blacklist test
Restored original test and marked tests for VFS as unsupported on Windows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374011 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 7a835aa commit d798a1e

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

test/CodeGen/ubsan-blacklist-vfs.c

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// UNSUPPORTED: system-windows
2+
3+
// Verify ubsan doesn't emit checks for blacklisted functions and files
4+
// RUN: echo "fun:hash" > %t-func.blacklist
5+
// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.blacklist
6+
7+
// RUN: rm -f %t-vfsoverlay.yaml
8+
// RUN: rm -f %t-nonexistent.blacklist
9+
// 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
10+
// 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
11+
12+
// 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
13+
// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or directory
14+
15+
// 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
16+
// INVALID: nonexistent.blacklist': No such file or directory
17+
18+
unsigned i;
19+
20+
// DEFAULT: @hash
21+
// FUNC: @hash
22+
// FILE: @hash
23+
unsigned hash() {
24+
// DEFAULT: call {{.*}}void @__ubsan
25+
// FUNC-NOT: call {{.*}}void @__ubsan
26+
// FILE-NOT: call {{.*}}void @__ubsan
27+
return i * 37;
28+
}
29+
30+
// DEFAULT: @add
31+
// FUNC: @add
32+
// FILE: @add
33+
unsigned add() {
34+
// DEFAULT: call {{.*}}void @__ubsan
35+
// FUNC: call {{.*}}void @__ubsan
36+
// FILE-NOT: call {{.*}}void @__ubsan
37+
return i + 1;
38+
}

test/CodeGen/ubsan-blacklist.c

-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-func.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
66
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE
77

8-
// RUN: rm -f %t-vfsoverlay.yaml
9-
// RUN: rm -f %t-nonexistent.blacklist
10-
// 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
11-
// 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
12-
13-
// 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
14-
// INVALID-MAPPED-FILE: invalid-virtual-file.blacklist': No such file or directory
15-
16-
// 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
17-
// INVALID: nonexistent.blacklist': No such file or directory
18-
198
unsigned i;
209

2110
// DEFAULT: @hash

0 commit comments

Comments
 (0)