[PATCH] D92415: [GWP-ASan] Fix flaky test on Fuchsia
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 11:46:54 PST 2020
cryptoad created this revision.
cryptoad added reviewers: mcgrathr, hctim, eugenis.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
cryptoad requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92415
Files:
compiler-rt/lib/gwp_asan/tests/late_init.cpp
Index: compiler-rt/lib/gwp_asan/tests/late_init.cpp
===================================================================
--- compiler-rt/lib/gwp_asan/tests/late_init.cpp
+++ compiler-rt/lib/gwp_asan/tests/late_init.cpp
@@ -10,7 +10,9 @@
#include "gwp_asan/options.h"
#include "gwp_asan/tests/harness.h"
-TEST(LateInit, CheckLateInitIsOK) {
+#include <thread>
+
+static void checkLateInitIsOK() {
gwp_asan::GuardedPoolAllocator GPA;
for (size_t i = 0; i < 0x100; ++i)
@@ -23,3 +25,8 @@
GPA.init(Opts);
EXPECT_TRUE(GPA.shouldSample());
}
+
+TEST(LateInit, CheckLateInitIsOK) {
+ std::thread Thread(checkLateInitIsOK);
+ Thread.join();
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92415.308726.patch
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201201/8a4267ef/attachment.bin>
More information about the llvm-commits
mailing list