]> git.apps.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>
Fri, 22 Mar 2019 22:12:13 +0000 (01:12 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit ed8a93ba387458961444913a8695f538595efacf)

src/test/objectstore/fastbmap_allocator_test.cc

index 5c5503a806280600548716f53d016c6735eea70e..709db601916921c16b57725b8bea40625199ef00 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