From 23cd8d51ad519261137a40a5bbac6e537ee7ba25 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 9 Feb 2021 09:17:23 -0500 Subject: [PATCH] Try to fix compiler-rt tests after 87dbdd2e3bb63b 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. --- .../test/asan/TestCases/large_func_test.cpp | 10 +++++---- .../test/asan/TestCases/strncpy-overflow.cpp | 21 ++++++++----------- .../test/asan/TestCases/use-after-delete.cpp | 14 ++++++++----- .../test/asan/TestCases/use-after-free-right.cpp | 24 ++++++++-------------- compiler-rt/test/asan/TestCases/use-after-free.cpp | 24 ++++++++-------------- 5 files changed, 39 insertions(+), 54 deletions(-) diff --git a/compiler-rt/test/asan/TestCases/large_func_test.cpp b/compiler-rt/test/asan/TestCases/large_func_test.cpp index 776e193..1fbed41 100644 --- a/compiler-rt/test/asan/TestCases/large_func_test.cpp +++ b/compiler-rt/test/asan/TestCases/large_func_test.cpp @@ -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; } diff --git a/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp b/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp index 3047b7f8..129cc92 100644 --- a/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp @@ -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]; } diff --git a/compiler-rt/test/asan/TestCases/use-after-delete.cpp b/compiler-rt/test/asan/TestCases/use-after-delete.cpp index c72e0f7..3370360 100644 --- a/compiler-rt/test/asan/TestCases/use-after-delete.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-delete.cpp @@ -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: diff --git a/compiler-rt/test/asan/TestCases/use-after-free-right.cpp b/compiler-rt/test/asan/TestCases/use-after-free-right.cpp index c4ae281..10dbe5b 100644 --- a/compiler-rt/test/asan/TestCases/use-after-free-right.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-free-right.cpp @@ -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]] } diff --git a/compiler-rt/test/asan/TestCases/use-after-free.cpp b/compiler-rt/test/asan/TestCases/use-after-free.cpp index 54cd32d..4b20ee2 100644 --- a/compiler-rt/test/asan/TestCases/use-after-free.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-free.cpp @@ -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 @@ -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: -- 2.7.4