[scudo][NFC] Make tests runs with --gtest_repeat=2

Reviewed By: cryptoad

Differential Revision: https://reviews.llvm.org/D99766
This commit is contained in:
Vitaly Buka 2021-04-01 12:40:28 -07:00
parent ce9e1a3632
commit 622500479b
2 changed files with 9 additions and 1 deletions

View File

@ -201,6 +201,7 @@ static void stressSharedRegistry(MockAllocator<SharedCaches> *Allocator) {
TEST(ScudoTSDTest, TSDRegistryTSDsCount) {
Ready = false;
Pointers.clear();
using AllocatorT = MockAllocator<SharedCaches>;
auto Deleter = [](AllocatorT *A) {
A->unmapTestOnly();

View File

@ -43,7 +43,14 @@ template <class Allocator> struct TSDRegistryExT {
initLinkerInitialized(Instance); // Sets Initialized.
}
void unmapTestOnly() {}
void unmapTestOnly() {
Allocator *Instance =
reinterpret_cast<Allocator *>(pthread_getspecific(PThreadKey));
if (!Instance)
return;
ThreadTSD.commitBack(Instance);
State = {};
}
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance, bool MinimalInit) {
if (LIKELY(State.InitState != ThreadState::NotInitialized))