[PATCH] D42862: [asan] Make concurrent_overflow.cc less flaky

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 11:44:11 PST 2018


kubamracek created this revision.
kubamracek added reviewers: vitalybuka, eugenis, filcab, delcypher.
kubamracek added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

The "sleep(5)" sometimes times out on our bots, causing the test to fail. Let's use pthread_join.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42862

Files:
  test/asan/TestCases/Posix/concurrent_overflow.cc


Index: test/asan/TestCases/Posix/concurrent_overflow.cc
===================================================================
--- test/asan/TestCases/Posix/concurrent_overflow.cc
+++ test/asan/TestCases/Posix/concurrent_overflow.cc
@@ -20,11 +20,12 @@
 int main(void) {
   const int n_threads = 8;
   int i, counter = n_threads;
-  pthread_t thread;
+  pthread_t thread[n_threads];
 
   for (i = 0; i < n_threads; ++i)
-    pthread_create(&thread, NULL, &start_routine, (void *)&counter);
-  sleep(5);
+    pthread_create(&thread[i], NULL, &start_routine, (void *)&counter);
+  for (i = 0; i < n_threads; ++i)
+    pthread_join(thread[i], NULL);
   return 0;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42862.132643.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180202/2aa704f4/attachment.bin>


More information about the llvm-commits mailing list