Make test more lenient for custom clang version strings
[llvm-project.git] / compiler-rt / test / asan / TestCases / ignorelist.cpp
blob348ea5d350bf16191fa23309211baed168cdb419
1 // Test the ignorelist functionality of ASan
3 // RUN: echo "fun:*brokenFunction*" > %tmp
4 // RUN: echo "global:*badGlobal*" >> %tmp
5 // RUN: echo "src:*ignorelist-extra.cpp" >> %tmp
6 // RUN: %clangxx_asan -fsanitize-ignorelist=%tmp -O0 %s -o %t \
7 // RUN: %p/Helpers/ignorelist-extra.cpp && %run %t 2>&1
8 // RUN: %clangxx_asan -fsanitize-ignorelist=%tmp -O1 %s -o %t \
9 // RUN: %p/Helpers/ignorelist-extra.cpp && %run %t 2>&1
10 // RUN: %clangxx_asan -fsanitize-ignorelist=%tmp -O2 %s -o %t \
11 // RUN: %p/Helpers/ignorelist-extra.cpp && %run %t 2>&1
12 // RUN: %clangxx_asan -fsanitize-ignorelist=%tmp -O3 %s -o %t \
13 // RUN: %p/Helpers/ignorelist-extra.cpp && %run %t 2>&1
15 // badGlobal is accessed improperly, but we ignorelisted it. Align
16 // it to make sure memory past the end of badGlobal will be in
17 // the same page.
18 __attribute__((aligned(16))) int badGlobal;
19 int readBadGlobal() {
20 return (&badGlobal)[1];
23 // A function which is broken, but excluded in the ignorelist.
24 int brokenFunction(int argc) {
25 char x[10] = {0};
26 return x[argc * 10]; // BOOM
29 // This function is defined in Helpers/ignorelist-extra.cpp, a source file which
30 // is ignorelisted by name
31 int externalBrokenFunction(int x);
33 int main(int argc, char **argv) {
34 brokenFunction(argc);
35 int x = readBadGlobal();
36 externalBrokenFunction(argc);
37 return 0;