| 1 |
// General ignorelist usage. |
| 2 |
|
| 3 |
// PR12920 |
| 4 |
|
| 5 |
// Make sure we don't match the -NOT lines with the linker invocation. |
| 6 |
// Delimiters match the start of the cc1 and the start of the linker lines |
| 7 |
// for fragile tests. |
| 8 |
// DELIMITERS: {{^ (\(in-process\)|")}} |
| 9 |
|
| 10 |
// RUN: echo "fun:foo" > %t.good |
| 11 |
// RUN: echo "fun:bar" > %t.second |
| 12 |
// RUN: echo "badline" > %t.bad |
| 13 |
|
| 14 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST |
| 15 |
// RUN: %clang --target=aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST |
| 16 |
// CHECK-IGNORELIST: -fsanitize-ignorelist={{.*}}.good" "-fsanitize-ignorelist={{.*}}.second |
| 17 |
|
| 18 |
// Check that the default ignorelist is not added as an extra dependency. |
| 19 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 20 |
// CHECK-DEFAULT-IGNORELIST-ASAN: -fsanitize-system-ignorelist={{.*[^w]}}asan_ignorelist.txt |
| 21 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 22 |
// CHECK-DEFAULT-IGNORELIST-HWASAN: -fsanitize-system-ignorelist={{.*}}hwasan_ignorelist.txt |
| 23 |
|
| 24 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 25 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 26 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 27 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 28 |
// RUN: %clang --target=%itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 29 |
// CHECK-DEFAULT-UBSAN-IGNORELIST: -fsanitize-system-ignorelist={{.*}}ubsan_ignorelist.txt |
| 30 |
|
| 31 |
// Check that combining ubsan and another sanitizer results in both ignorelists being used. |
| 32 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= |
| 33 |
|
| 34 |
// Ignore -fsanitize-ignorelist flag if there is no -fsanitize flag. |
| 35 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS |
| 36 |
// CHECK-NO-SANITIZE-NOT: -fsanitize-ignorelist |
| 37 |
|
| 38 |
// Ignore -fsanitize-ignorelist flag if there is no -fsanitize flag. |
| 39 |
// Now, check for the absence of -fdepfile-entry flags. |
| 40 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS |
| 41 |
// CHECK-NO-SANITIZE2-NOT: -fdepfile-entry |
| 42 |
|
| 43 |
// Flag -fno-sanitize-ignorelist wins if it is specified later. |
| 44 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IGNORELIST --check-prefix=DELIMITERS |
| 45 |
// CHECK-NO-IGNORELIST-NOT: -fsanitize-ignorelist |
| 46 |
|
| 47 |
// Driver barks on unexisting ignorelist files. |
| 48 |
// RUN: not %clang --target=x86_64-linux-gnu -fno-sanitize-ignorelist -fsanitize-ignorelist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE |
| 49 |
// CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt' |
| 50 |
|
| 51 |
// Driver properly reports malformed ignorelist files. |
| 52 |
// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.second -fsanitize-ignorelist=%t.bad -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-IGNORELIST |
| 53 |
// CHECK-BAD-IGNORELIST: error: malformed sanitizer ignorelist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' |
| 54 |
|
| 55 |
// -fno-sanitize-ignorelist disables all ignorelists specified earlier. |
| 56 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-ignorelist= |
| 57 |
// CHECK-ONLY_FIRST-DISABLED-NOT: good |
| 58 |
// CHECK-ONLY-FIRST-DISABLED: -fsanitize-ignorelist={{.*}}.second |
| 59 |
// CHECK-ONLY_FIRST-DISABLED-NOT: good |
| 60 |
|
| 61 |
// -fno-sanitize-ignorelist disables the system ignorelists. |
| 62 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS |
| 63 |
// CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-ignorelist |
| 64 |
|
| 65 |
// If cfi_ignorelist.txt cannot be found in the resource dir, driver should fail. |
| 66 |
// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-IGNORELIST |
| 67 |
// CHECK-MISSING-CFI-IGNORELIST: error: missing sanitizer ignorelist: '{{.*}}cfi_ignorelist.txt' |
| 68 |
|
| 69 |
// -fno-sanitize-ignorelist disables checking for cfi_ignorelist.txt in the resource dir. |
| 70 |
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-ignorelist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-IGNORELIST |
| 71 |
// CHECK-MISSING-CFI-NO-IGNORELIST-NOT: error: no such file or directory: '{{.*}}cfi_ignorelist.txt' |
| 72 |
|
| 73 |
// DELIMITERS: {{^ *"}} |