]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests/fastbmap_alloc: UT to reproduce 4G allocation bug
authorIgor Fedotov <ifedotov@suse.com>
Wed, 13 Mar 2019 14:02:13 +0000 (17:02 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 2 Apr 2019 09:51:59 +0000 (12:51 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit ed8a93ba387458961444913a8695f538595efacf)

src/test/objectstore/fastbmap_allocator_test.cc

index a13cf20c3d4da2f26e1860d03d21c5376bc0b73b..f5a046858f685db7d00d3bc25f134aa87c21cf6f 100755 (executable)
@@ -854,3 +854,20 @@ TEST(TestAllocatorLevel01, test_l2_contiguous_alignment)
   std::cout << "Done L2 cont aligned" << std::endl;
 }
 
+TEST(TestAllocatorLevel01, test_4G_alloc_bug)
+{
+  {
+    TestAllocatorLevel02 al2;
+    uint64_t capacity = 0x8000 * _1m; // = 32GB
+    al2.init(capacity, 0x10000);
+    std::cout << "Init L2 cont aligned" << std::endl;
+
+      uint64_t allocated4 = 0;
+      interval_vector_t a4;
+      al2.allocate_l2(_1m, _1m, &allocated4, &a4);
+      ASSERT_EQ(a4.size(), 1u); // the bug caused no allocations here
+      ASSERT_EQ(allocated4, _1m);
+      ASSERT_EQ(a4[0].offset, 0u);
+      ASSERT_EQ(a4[0].length, _1m);
+  }
+}
\ No newline at end of file