[compiler-rt] 6225004 - [scudo][NFC] Make tests runs with --gtest_repeat=2
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 1 13:37:53 PDT 2021
Author: Vitaly Buka
Date: 2021-04-01T13:37:42-07:00
New Revision: 622500479b521554d2c869633eb6cf51c8d47ba1
URL: https://github.com/llvm/llvm-project/commit/622500479b521554d2c869633eb6cf51c8d47ba1
DIFF: https://github.com/llvm/llvm-project/commit/622500479b521554d2c869633eb6cf51c8d47ba1.diff
LOG: [scudo][NFC] Make tests runs with --gtest_repeat=2
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D99766
Added:
Modified:
compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
compiler-rt/lib/scudo/standalone/tsd_exclusive.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
index 561bda47e24c..58ac9e74b985 100644
--- a/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
@@ -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();
diff --git a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
index c9a9de121d9b..04850405959b 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
@@ -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))
More information about the llvm-commits
mailing list