Try to fix compiler-rt tests after 87dbdd2e3b on mac and win

These tests use `--check-prefix=CHECK-%os` but then didn't have
a CHECK line for every os.

In most tests, the linux expectations were sufficient (they match
the "wrap_" prefix with .*), so just remove the check-prefix there.
In the places where this didn't easily work, make sure there are
at least CHECK-Windows and CHECK-Darwin lines.
This commit is contained in:
Nico Weber 2021-02-09 09:17:23 -05:00
parent 521e1733f1
commit 23cd8d51ad
5 changed files with 39 additions and 54 deletions

View File

@ -25,7 +25,8 @@ static void LargeFunction(int *x, int zero) {
// atos incorrectly extracts the symbol name for the static functions on
// Darwin.
// CHECK-Linux: {{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-3]]
// CHECK-Darwin: {{#0 0x.* in .*LargeFunction.*large_func_test.cpp}}:[[@LINE-4]]
// CHECK-Windows:{{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-4]]
// CHECK-Darwin: {{#0 0x.* in .*LargeFunction.*large_func_test.cpp}}:[[@LINE-5]]
x[10]++;
x[11]++;
@ -45,8 +46,9 @@ int main(int argc, char **argv) {
// CHECK: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-1]]
// CHECK: {{0x.* is located 12 bytes to the right of 400-byte region}}
// CHECK: {{allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in operator new.*}}
// CHECK-Darwin: {{ #0 0x.* in .*_Zna.*}}
// CHECK: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-7]]
// CHECK-Linux: {{ #0 0x.* in operator new}}
// CHECK-Windows:{{ #0 0x.* in operator new}}
// CHECK-Darwin: {{ #0 0x.* in .*_Zna}}
// CHECK: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-8]]
delete[] x;
}

View File

@ -1,7 +1,7 @@
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
// REQUIRES: compiler-rt-optimized
// REQUIRES: stable-runtime
@ -14,16 +14,11 @@ int main(int argc, char **argv) {
char *short_buffer = (char*)malloc(9);
strncpy(short_buffer, hello, 10); // BOOM
// CHECK: {{WRITE of size 10 at 0x.* thread T0}}
// CHECK-Linux: {{ #0 0x.* in .*strncpy}}
// CHECK-Darwin: {{ #0 0x.* in wrap_strncpy}}
// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cpp:}}[[@LINE-4]]
// CHECK: {{ #0 0x.* in .*strncpy}}
// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cpp:}}[[@LINE-3]]
// CHECK: {{0x.* is located 0 bytes to the right of 9-byte region}}
// CHECK: {{allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
// CHECK-Linux: {{ #1 0x.* in main .*strncpy-overflow.cpp:}}[[@LINE-10]]
// CHECK-Darwin: {{ #0 0x.* in wrap_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in main .*strncpy-overflow.cpp:}}[[@LINE-13]]
// CHECK: {{ #0 0x.* in .*malloc}}
// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cpp:}}[[@LINE-8]]
return short_buffer[8];
}

View File

@ -14,15 +14,19 @@ int main() {
// CHECK: {{READ of size 1 at 0x.* thread T0}}
// CHECK: {{ #0 0x.* in main .*use-after-delete.cpp:}}[[@LINE-4]]
// CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}}
// CHECK: {{freed by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in operator delete\[\]}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-10]]
// CHECK: {{freed by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in operator delete\[\]}}
// CHECK-Windows:{{ #0 0x.* in operator delete\[\]}}
// CHECK-Darwin: {{ #0 0x.* in .*_Zda}}
// CHECK: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-12]]
// CHECK: {{previously allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in operator new\[\]}}
// CHECK-Windows:{{ #0 0x.* in operator new\[\]}}
// CHECK-Darwin: {{ #0 0x.* in .*_Zna}}
// CHECK: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-19]]
// CHECK-Linux: {{ #0 0x.* in operator new\[\]}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-16]]
// CHECK: Shadow byte legend (one shadow byte represents {{[0-9]+}} application bytes):
// CHECK: Global redzone:

View File

@ -1,7 +1,7 @@
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime
// Test use-after-free report in the case when access is at the right border of
@ -18,18 +18,10 @@ int main() {
// CHECK: {{ #0 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-4]]
// CHECK: {{0x.* is located 0 bytes inside of 1-byte region .0x.*,0x.*}}
// CHECK: {{freed by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*free}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-10]]
// CHECK-Darwin: {{ #0 0x.* in wrap_free}}
// CHECK-Darwin: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-13]]
// CHECK: {{ #0 0x.* in .*free}}
// CHECK: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-9]]
// CHECK: {{previously allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-19]]
// CHECK-Darwin: {{ #0 0x.* in wrap_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-22]]
// CHECK: {{ #0 0x.* in .*malloc}}
// CHECK: {{ #1 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-14]]
}

View File

@ -1,7 +1,7 @@
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime
#include <stdlib.h>
@ -15,20 +15,12 @@ int main() {
// CHECK: {{ #0 0x.* in main .*use-after-free.cpp:}}[[@LINE-4]]
// CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}}
// CHECK: {{freed by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*free}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-10]]
// CHECK-Darwin: {{ #0 0x.* in wrap_free}}
// CHECK-Darwin: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-13]]
// CHECK: {{ #0 0x.* in .*free}}
// CHECK: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-9]]
// CHECK: {{previously allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
// CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-19]]
// CHECK-Darwin: {{ #0 0x.* in wrap_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-22]]
// CHECK: {{ #0 0x.* in .*malloc}}
// CHECK: {{ #1 0x.* in main .*use-after-free.cpp:}}[[@LINE-14]]
// CHECK: Shadow byte legend (one shadow byte represents {{[0-9]+}} application bytes):
// CHECK: Global redzone:
// CHECK: ASan internal: