From: Igor Fedotov Date: Wed, 13 Mar 2019 14:02:13 +0000 (+0300) Subject: tests/fastbmap_alloc: UT to reproduce 4G allocation bug X-Git-Tag: v14.2.1~104^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2eb7a6486e7f6768808f929e7a2b6aa5945225cd;p=ceph.git tests/fastbmap_alloc: UT to reproduce 4G allocation bug Signed-off-by: Igor Fedotov (cherry picked from commit ed8a93ba387458961444913a8695f538595efacf) --- diff --git a/src/test/objectstore/fastbmap_allocator_test.cc b/src/test/objectstore/fastbmap_allocator_test.cc index 5c5503a806280..709db60191692 100755 --- a/src/test/objectstore/fastbmap_allocator_test.cc +++ b/src/test/objectstore/fastbmap_allocator_test.cc @@ -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