[compiler-rt] r262000 - Use relative lines in CHECKs in race_on_mutex.c
Alexander Kornienko via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 03:09:33 PST 2016
Author: alexfh
Date: Fri Feb 26 05:09:32 2016
New Revision: 262000
URL: http://llvm.org/viewvc/llvm-project?rev=262000&view=rev
Log:
Use relative lines in CHECKs in race_on_mutex.c
Modified:
compiler-rt/trunk/test/tsan/race_on_mutex.c
Modified: compiler-rt/trunk/test/tsan/race_on_mutex.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/race_on_mutex.c?rev=262000&r1=261999&r2=262000&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/race_on_mutex.c (original)
+++ compiler-rt/trunk/test/tsan/race_on_mutex.c Fri Feb 26 05:09:32 2016
@@ -11,20 +11,27 @@
pthread_mutex_t Mtx;
int Global;
-void *Thread1(void *x) {
- pthread_mutex_init(&Mtx, 0);
+void *Thread2(void *x) {
+ barrier_wait(&barrier);
+// CHECK: WARNING: ThreadSanitizer: data race
+// CHECK-NEXT: Atomic read of size 1 at {{.*}} by thread T2:
+// CHECK-NEXT: #0 pthread_mutex_lock
+// CHECK-NEXT: #1 Thread2{{.*}} {{.*}}race_on_mutex.c:[[@LINE+1]]{{(:3)?}} ({{.*}})
pthread_mutex_lock(&Mtx);
- Global = 42;
+ Global = 43;
pthread_mutex_unlock(&Mtx);
- barrier_wait(&barrier);
return NULL;
}
-void *Thread2(void *x) {
- barrier_wait(&barrier);
+void *Thread1(void *x) {
+// CHECK: Previous write of size 1 at {{.*}} by thread T1:
+// CHECK-NEXT: #0 pthread_mutex_init {{.*}} ({{.*}})
+// CHECK-NEXT: #1 Thread1{{.*}} {{.*}}race_on_mutex.c:[[@LINE+1]]{{(:3)?}} ({{.*}})
+ pthread_mutex_init(&Mtx, 0);
pthread_mutex_lock(&Mtx);
- Global = 43;
+ Global = 42;
pthread_mutex_unlock(&Mtx);
+ barrier_wait(&barrier);
return NULL;
}
@@ -38,11 +45,3 @@ int main() {
pthread_mutex_destroy(&Mtx);
return 0;
}
-
-// CHECK: WARNING: ThreadSanitizer: data race
-// CHECK-NEXT: Atomic read of size 1 at {{.*}} by thread T2:
-// CHECK-NEXT: #0 pthread_mutex_lock
-// CHECK-NEXT: #1 Thread2{{.*}} {{.*}}race_on_mutex.c:21{{(:3)?}} ({{.*}})
-// CHECK: Previous write of size 1 at {{.*}} by thread T1:
-// CHECK-NEXT: #0 pthread_mutex_init {{.*}} ({{.*}})
-// CHECK-NEXT: #1 Thread1{{.*}} {{.*}}race_on_mutex.c:11{{(:3)?}} ({{.*}})
More information about the llvm-commits
mailing list