[compiler-rt] 23cd8d5 - Try to fix compiler-rt tests after 87dbdd2e3bb63b on mac and win
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 06:29:05 PST 2021
Author: Nico Weber
Date: 2021-02-09T09:28:52-05:00
New Revision: 23cd8d51ad519261137a40a5bbac6e537ee7ba25
URL: https://github.com/llvm/llvm-project/commit/23cd8d51ad519261137a40a5bbac6e537ee7ba25
DIFF: https://github.com/llvm/llvm-project/commit/23cd8d51ad519261137a40a5bbac6e537ee7ba25.diff
LOG: 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.
Added:
Modified:
compiler-rt/test/asan/TestCases/large_func_test.cpp
compiler-rt/test/asan/TestCases/strncpy-overflow.cpp
compiler-rt/test/asan/TestCases/use-after-delete.cpp
compiler-rt/test/asan/TestCases/use-after-free-right.cpp
compiler-rt/test/asan/TestCases/use-after-free.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/large_func_test.cpp b/compiler-rt/test/asan/TestCases/large_func_test.cpp
index 776e193937dd..1fbed41130df 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 3047b7f8ad08..129cc9269dfc 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 c72e0f7919a7..33703600e998 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 c4ae2810c6bc..10dbe5b90568 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 54cd32ddaa65..4b20ee25500c 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 <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:
More information about the llvm-commits
mailing list