[GWP-ASan] Fix flaky test on Fuchsia
authorKostya Kortchinsky <kostyak@google.com>
Tue, 1 Dec 2020 19:46:23 +0000 (11:46 -0800)
committerKostya Kortchinsky <kostyak@google.com>
Wed, 2 Dec 2020 17:00:51 +0000 (09:00 -0800)
The LateInit test might be reusing some already initialized thread
specific data if run within the main thread. This means that there
is a chance that the current value will not be enough for the 100
iterations, hence the test flaking.

Fix this by making the test run in its own thread.

Differential Revision: https://reviews.llvm.org/D92415

compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp

index a895032..13888cb 100644 (file)
@@ -148,6 +148,7 @@ void GuardedPoolAllocator::uninitTestOnly() {
                     State.PageSize));
     FreeSlots = nullptr;
   }
+  *getThreadLocals() = ThreadLocalPackedVariables();
 }
 
 void *GuardedPoolAllocator::allocate(size_t Size) {