aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/test
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/asan/TestCases/strcmp.c4
-rw-r--r--compiler-rt/test/tsan/cxa_guard_acquire.cpp13
2 files changed, 13 insertions, 4 deletions
diff --git a/compiler-rt/test/asan/TestCases/strcmp.c b/compiler-rt/test/asan/TestCases/strcmp.c
index 417bd49..2b31e64 100644
--- a/compiler-rt/test/asan/TestCases/strcmp.c
+++ b/compiler-rt/test/asan/TestCases/strcmp.c
@@ -14,6 +14,8 @@ int main(int argc, char **argv) {
assert(strcmp(s1 - 1, s2));
// CHECK: {{.*ERROR: AddressSanitizer: stack-buffer-underflow on address}}
- // CHECK: READ of size 1
+ // Very rarely `s1[-1]` happens to be '1', resulting in `strcmp` needing to
+ // check 2 bytes before failing, rather than 1 - this should still pass
+ // CHECK: READ of size {{[12]}}
return 0;
}
diff --git a/compiler-rt/test/tsan/cxa_guard_acquire.cpp b/compiler-rt/test/tsan/cxa_guard_acquire.cpp
index fc40725..6050c24 100644
--- a/compiler-rt/test/tsan/cxa_guard_acquire.cpp
+++ b/compiler-rt/test/tsan/cxa_guard_acquire.cpp
@@ -66,10 +66,17 @@ int main(int argc, char **argv) {
printf("Enter main\n");
// If initialization is contended, the blocked thread should enter a
- // potentially blocking region.
+ // potentially blocking region. Note that we use a DAG check because it is
+ // possible for Thread 1 to acquire the guard, then Thread 2 fail to acquire
+ // the guard then call `OnPotentiallyBlockingRegionBegin` and print "Enter
+ // potentially blocking region\n", before Thread 1 manages to reach "Enter
+ // constructor\n". This is exceptionally rare, but can be replicated by
+ // inserting a `sleep(1)` between `LazyInit() {` and `printf("Enter
+ // constructor\n");`. Due to the barrier it is not possible for the exit logs
+ // to be inverted.
//
- // CHECK-NEXT: Enter constructor
- // CHECK-NEXT: Enter potentially blocking region
+ // CHECK-DAG: Enter constructor
+ // CHECK-DAG: Enter potentially blocking region
// CHECK-NEXT: Exit constructor
// CHECK-NEXT: Exit potentially blocking region
barrier_init(&barrier, 2);