[Asan] Fix the tsd_dtor_leak.cc test to pass on FreeBSD
authorViktor Kutuzov <vkutuzov@accesssoftek.com>
Fri, 12 Dec 2014 12:09:56 +0000 (12:09 +0000)
committerViktor Kutuzov <vkutuzov@accesssoftek.com>
Fri, 12 Dec 2014 12:09:56 +0000 (12:09 +0000)
Differential Revision: http://reviews.llvm.org/D6590

llvm-svn: 224116

compiler-rt/test/asan/TestCases/Posix/tsd_dtor_leak.cc

index 32253af..cdccf1a 100644 (file)
@@ -34,6 +34,13 @@ int main() {
     fprintf(stderr, "heap size: new: %zd old: %zd\n", new_heap_size, old_heap_size);
     if (old_heap_size)
       assert(old_heap_size == new_heap_size);
+#if defined(__FreeBSD__)
+    // On FreeBSD SYSCALL(sched_yielld) allocates some more space during the
+    // 2nd attempt.
+    if (i > 0)
+      old_heap_size = new_heap_size;
+#else
     old_heap_size = new_heap_size;
+#endif
   }
 }