From dcddc54407e44b55815e9aa784c84f5c933ca310 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 31 Jan 2023 08:00:06 -0800 Subject: Rollback in sanitizer mode, detect when references become invalidated by randomly rehashing on insertions when there is no reserved growth. Rollback of ed59f62f8bbc5f05bcba2f89ee16f107e03813f2 PiperOrigin-RevId: 506003574 Change-Id: I1766321f279a3226e2821e0390387d5639d28964 --- absl/container/internal/raw_hash_set_test.cc | 31 ---------------------------- 1 file changed, 31 deletions(-) (limited to 'absl/container/internal/raw_hash_set_test.cc') diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc index e33fda20..bdffb817 100644 --- a/absl/container/internal/raw_hash_set_test.cc +++ b/absl/container/internal/raw_hash_set_test.cc @@ -865,10 +865,6 @@ void TestDecompose(bool construct_three) { } TEST(Table, Decompose) { - if (SwisstableGenerationsEnabled()) { - GTEST_SKIP() << "Generations being enabled causes extra rehashes."; - } - TestDecompose(false); struct TransparentHashIntOverload { @@ -907,10 +903,6 @@ struct Modulo1000HashTable // Test that rehash with no resize happen in case of many deleted slots. TEST(Table, RehashWithNoResize) { - if (SwisstableGenerationsEnabled()) { - GTEST_SKIP() << "Generations being enabled causes extra rehashes."; - } - Modulo1000HashTable t; // Adding the same length (and the same hash) strings // to have at least kMinFullGroups groups @@ -1004,10 +996,6 @@ TEST(Table, EnsureNonQuadraticAsInRust) { } TEST(Table, ClearBug) { - if (SwisstableGenerationsEnabled()) { - GTEST_SKIP() << "Generations being enabled causes extra rehashes."; - } - IntTable t; constexpr size_t capacity = container_internal::Group::kWidth - 1; constexpr size_t max_size = capacity / 2 + 1; @@ -2330,25 +2318,6 @@ TEST(Table, ReservedGrowthUpdatesWhenTableDoesntGrow) { EXPECT_EQ(*it, 0); } -TEST(Table, InvalidReferenceUseCrashesWithSanitizers) { - if (!SwisstableGenerationsEnabled()) GTEST_SKIP() << "Generations disabled."; -#ifdef ABSL_HAVE_MEMORY_SANITIZER - GTEST_SKIP() << "MSan fails to detect some of these rehashes."; -#endif - - IntTable t; - t.insert(0); - // Rehashing is guaranteed on every insertion while capacity is less than - // RehashProbabilityConstant(). - int64_t i = 0; - while (t.capacity() <= RehashProbabilityConstant()) { - // ptr will become invalidated on rehash. - const int64_t* ptr = &*t.begin(); - t.insert(++i); - EXPECT_DEATH_IF_SUPPORTED(std::cout << *ptr, "heap-use-after-free") << i; - } -} - } // namespace } // namespace container_internal ABSL_NAMESPACE_END -- cgit v1.2.3