[compiler-rt] 402a406 - [NFC][sanitizer] Test for b80affb8a149

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 16:56:50 PST 2021


Author: Vitaly Buka
Date: 2021-11-23T16:56:24-08:00
New Revision: 402a406323194e0eaecfb793416e8c7528befc29

URL: https://github.com/llvm/llvm-project/commit/402a406323194e0eaecfb793416e8c7528befc29
DIFF: https://github.com/llvm/llvm-project/commit/402a406323194e0eaecfb793416e8c7528befc29.diff

LOG: [NFC][sanitizer] Test for b80affb8a149

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/tests/sanitizer_stack_store_test.cpp

Removed: 
    


################################################################################
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 3a2db148f2d5..c7cb041482b6 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<StackStore::Id> ids;
   ForEachTrace([&](const StackTrace& s) { ids.push_back(store_.Store(s)); });


        


More information about the llvm-commits mailing list