[compiler-rt] r205619 - tsan: improve error message in test

Dmitry Vyukov dvyukov at google.com
Fri Apr 4 02:52:41 PDT 2014


Author: dvyukov
Date: Fri Apr  4 04:52:41 2014
New Revision: 205619

URL: http://llvm.org/viewvc/llvm-project?rev=205619&view=rev
Log:
tsan: improve error message in test
we've seen a flake on this test
next time it happens we will be able to gather some info


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

Modified: compiler-rt/trunk/test/tsan/race_on_read.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/race_on_read.cc?rev=205619&r1=205618&r2=205619&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/race_on_read.cc (original)
+++ compiler-rt/trunk/test/tsan/race_on_read.cc Fri Apr  4 04:52:41 2014
@@ -6,6 +6,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <errno.h>
 
 int fd;
 char buf;
@@ -18,13 +19,17 @@ void *Thread(void *x) {
 
 int main() {
   fd = open("/dev/random", O_RDONLY);
-  if (fd < 0) return 1;
+  if (fd < 0) {
+    fprintf(stderr, "failed to open /dev/random (%d)\n", errno);
+    return 1;
+  }
   pthread_t t[2];
   pthread_create(&t[0], NULL, Thread, NULL);
   pthread_create(&t[1], NULL, Thread, NULL);
   pthread_join(t[0], NULL);
   pthread_join(t[1], NULL);
   close(fd);
+  fprintf(stderr, "DONE\n");
 }
 
 // CHECK: WARNING: ThreadSanitizer: data race
@@ -32,3 +37,5 @@ int main() {
 // CHECK:     #0 read
 // CHECK:   Previous write of size 1
 // CHECK:     #0 read
+// CHECK: DONE
+





More information about the llvm-commits mailing list