[llvm-branch-commits] [compiler-rt] [TySan] Improved compatability for tests (PR #96507)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 24 08:15:19 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (gbMattN)
<details>
<summary>Changes</summary>
All the violation tests failed when running on my machine. By changing some check lines to regular expressions, we can account for file locality, and hardware specific type differences. There was also an include needed for better integer types.
---
Full diff: https://github.com/llvm/llvm-project/pull/96507.diff
6 Files Affected:
- (modified) compiler-rt/test/tysan/violation-pr45282.c (+1-1)
- (modified) compiler-rt/test/tysan/violation-pr47137.c (+3-2)
- (modified) compiler-rt/test/tysan/violation-pr62544.c (+1-1)
- (modified) compiler-rt/test/tysan/violation-pr62828.cpp (+1-1)
- (modified) compiler-rt/test/tysan/violation-pr68655.cpp (+1-1)
- (modified) compiler-rt/test/tysan/violation-pr86685.c (+1-1)
``````````diff
diff --git a/compiler-rt/test/tysan/violation-pr45282.c b/compiler-rt/test/tysan/violation-pr45282.c
index 2cbc37b3d1832..37e710ae18deb 100644
--- a/compiler-rt/test/tysan/violation-pr45282.c
+++ b/compiler-rt/test/tysan/violation-pr45282.c
@@ -18,7 +18,7 @@ int main(void) {
// CHECK: TypeSanitizer: type-aliasing-violation on address
// CHECK-NEXT: WRITE of size 8 at {{.+}} with type double accesses an existing object of type float
-// CHECK-NEXT: in main violation-pr45282.c:25
+// CHECK-NEXT: in main {{.*violation-pr45282.c:25.*}}
// loop of problems
for (j = 2; j <= 4; ++j) {
diff --git a/compiler-rt/test/tysan/violation-pr47137.c b/compiler-rt/test/tysan/violation-pr47137.c
index 04d68d1dd936e..7b996d39f81e2 100644
--- a/compiler-rt/test/tysan/violation-pr47137.c
+++ b/compiler-rt/test/tysan/violation-pr47137.c
@@ -4,6 +4,7 @@
// https://github.com/llvm/llvm-project/issues/47137
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
void f(int m) {
int n = (4 * m + 2) / 3;
@@ -23,8 +24,8 @@ void f(int m) {
}
// CHECK: TypeSanitizer: type-aliasing-violation on address
-// CHECK-NEXT: READ of size 2 at {{.+}} with type short accesses an existing object of type long long
-// CHECK-NEXT: in f violation-pr47137.c:30
+// CHECK-NEXT: READ of size 2 at {{.+}} with type short accesses an existing object of type {{(long)+}}
+// CHECK-NEXT: in f {{.*violation-pr47137.c:31.*}}
for (int i = 0, j = 0; j < 4 * m; i += 4, j += 3) {
for (int k = 0; k < 3; k++) {
((uint16_t *)a)[j + k] = ((uint16_t *)a)[i + k];
diff --git a/compiler-rt/test/tysan/violation-pr62544.c b/compiler-rt/test/tysan/violation-pr62544.c
index 4187a91bde3fc..7c6cb59156d15 100644
--- a/compiler-rt/test/tysan/violation-pr62544.c
+++ b/compiler-rt/test/tysan/violation-pr62544.c
@@ -18,7 +18,7 @@ int main() {
// CHECK: TypeSanitizer: type-aliasing-violation on address
// CHECK-NEXT: WRITE of size 2 at {{.+}} with type short accesses an existing object of type int
-// CHECK-NEXT: in main violation-pr62544.c:22
+// CHECK-NEXT: in main {{.*violation-pr62544.c:22.*}}
*e = 3;
printf("%d\n", a);
}
diff --git a/compiler-rt/test/tysan/violation-pr62828.cpp b/compiler-rt/test/tysan/violation-pr62828.cpp
index 879200c8069b0..f815227d86248 100644
--- a/compiler-rt/test/tysan/violation-pr62828.cpp
+++ b/compiler-rt/test/tysan/violation-pr62828.cpp
@@ -24,7 +24,7 @@ short *test1(int_v8 *cast_c_array, short_v8 *shuf_c_array1, int *ptr) {
// CHECK: ERROR: TypeSanitizer: type-aliasing-violation on address
// CHECK-NEXT: READ of size 2 at {{.+}} with type short accesses an existing object of type int
-// CHECK-NEXT: in test1(int (*) [8], short (*) [8], int*) violation-pr62828.cpp:29
+// CHECK-NEXT: in test1(int (*) [8], short (*) [8], int*) {{.*violation-pr62828.cpp:29.*}}
for (int i3 = 0; i3 < 4; ++i3) {
output2[i3] = input2[(i3 * 2)];
}
diff --git a/compiler-rt/test/tysan/violation-pr68655.cpp b/compiler-rt/test/tysan/violation-pr68655.cpp
index ac20f8c94e1ff..615971c75d20e 100644
--- a/compiler-rt/test/tysan/violation-pr68655.cpp
+++ b/compiler-rt/test/tysan/violation-pr68655.cpp
@@ -9,7 +9,7 @@ struct S1 {
// CHECK: TypeSanitizer: type-aliasing-violation on address
// CHECK-NEXT: READ of size 4 at {{.+}} with type int accesses an existing object of type long long (in S1 at offset 0)
-// CHECK-NEXT: in copyMem(S1*, S1*) violation-pr68655.cpp:19
+// CHECK-NEXT: in copyMem(S1*, S1*) {{.*violation-pr68655.cpp:19.*}}
void inline copyMem(S1 *dst, S1 *src) {
unsigned *d = reinterpret_cast<unsigned *>(dst);
diff --git a/compiler-rt/test/tysan/violation-pr86685.c b/compiler-rt/test/tysan/violation-pr86685.c
index b5198c440fa44..6667fc1805195 100644
--- a/compiler-rt/test/tysan/violation-pr86685.c
+++ b/compiler-rt/test/tysan/violation-pr86685.c
@@ -13,7 +13,7 @@ void foo(int *s, float *f, long n) {
// CHECK: TypeSanitizer: type-aliasing-violation on address
// CHECK-NEXT: WRITE of size 4 at {{.+}} with type int accesses an existing object of type float
-// CHECK-NEXT: #0 {{.+}} in foo violation-pr86685.c:17
+// CHECK-NEXT: #0 {{.+}} in foo {{.*violation-pr86685.c:17.*}}
*s = 4;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/96507
More information about the llvm-branch-commits
mailing list