[compiler-rt] r237387 - [tsan] deflakify one more tsan test

Kostya Serebryany kcc at google.com
Thu May 14 13:27:12 PDT 2015


Author: kcc
Date: Thu May 14 15:27:12 2015
New Revision: 237387

URL: http://llvm.org/viewvc/llvm-project?rev=237387&view=rev
Log:
[tsan] deflakify one more tsan test

Modified:
    compiler-rt/trunk/test/tsan/heap_race.cc

Modified: compiler-rt/trunk/test/tsan/heap_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/heap_race.cc?rev=237387&r1=237386&r2=237387&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/heap_race.cc (original)
+++ compiler-rt/trunk/test/tsan/heap_race.cc Thu May 14 15:27:12 2015
@@ -1,17 +1,21 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+#include "test.h"
 #include <pthread.h>
 #include <stdio.h>
 #include <stddef.h>
 
 void *Thread(void *a) {
   ((int*)a)[0]++;
+  barrier_wait(&barrier);
   return NULL;
 }
 
 int main() {
+  barrier_init(&barrier, 2);
   int *p = new int(42);
   pthread_t t;
   pthread_create(&t, NULL, Thread, p);
+  barrier_wait(&barrier);
   p[0]++;
   pthread_join(t, NULL);
   delete p;





More information about the llvm-commits mailing list