Skip to content

Commit 6225004

Browse files
committed
[scudo][NFC] Make tests runs with --gtest_repeat=2
Reviewed By: cryptoad Differential Revision: https://reviews.llvm.org/D99766
1 parent ce9e1a3 commit 6225004

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static void stressSharedRegistry(MockAllocator<SharedCaches> *Allocator) {
201201

202202
TEST(ScudoTSDTest, TSDRegistryTSDsCount) {
203203
Ready = false;
204+
Pointers.clear();
204205
using AllocatorT = MockAllocator<SharedCaches>;
205206
auto Deleter = [](AllocatorT *A) {
206207
A->unmapTestOnly();

compiler-rt/lib/scudo/standalone/tsd_exclusive.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ template <class Allocator> struct TSDRegistryExT {
4343
initLinkerInitialized(Instance); // Sets Initialized.
4444
}
4545

46-
void unmapTestOnly() {}
46+
void unmapTestOnly() {
47+
Allocator *Instance =
48+
reinterpret_cast<Allocator *>(pthread_getspecific(PThreadKey));
49+
if (!Instance)
50+
return;
51+
ThreadTSD.commitBack(Instance);
52+
State = {};
53+
}
4754

4855
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance, bool MinimalInit) {
4956
if (LIKELY(State.InitState != ThreadState::NotInitialized))

0 commit comments

Comments
 (0)