From 402a406323194e0eaecfb793416e8c7528befc29 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Sat, 20 Nov 2021 16:46:27 -0800 Subject: [PATCH] [NFC][sanitizer] Test for b80affb8a149 --- .../lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp index 3a2db14..c7cb041 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp @@ -33,6 +33,8 @@ class StackStoreTest : public testing::Test { h.add(i); uptr tag = h.get() % 256; StackTrace s(frames.data(), size, tag); + if (!s.size && !s.tag) + continue; fn(s); std::next_permutation(frames.begin(), frames.end()); }; @@ -41,6 +43,13 @@ class StackStoreTest : public testing::Test { StackStore store_ = {}; }; +TEST_F(StackStoreTest, Empty) { + uptr before = store_.Allocated(); + EXPECT_EQ(0u, store_.Store({})); + uptr after = store_.Allocated(); + EXPECT_EQ(before, after); +} + TEST_F(StackStoreTest, Basic) { std::vector ids; ForEachTrace([&](const StackTrace& s) { ids.push_back(store_.Store(s)); }); -- 2.7.4