From e61d9e4ada418404571f216a84fa4ed237104476 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 4 May 2017 08:11:13 -0500 Subject: [PATCH] unittest_alloc: add test_alloc_big Ensure that big allocations work. Verifies http://tracker.ceph.com/issues/16662 Signed-off-by: Sage Weil --- src/test/objectstore/Allocator_test.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/objectstore/Allocator_test.cc b/src/test/objectstore/Allocator_test.cc index 3a4082659629..65f8e47bd086 100644 --- a/src/test/objectstore/Allocator_test.cc +++ b/src/test/objectstore/Allocator_test.cc @@ -200,6 +200,22 @@ TEST_P(AllocTest, test_alloc_failure) } } +TEST_P(AllocTest, test_alloc_big) +{ + int64_t block_size = 4096; + int64_t blocks = 104857600; + int64_t mas = 4096; + init_alloc(blocks*block_size, block_size); + alloc->init_add_free(2*block_size, (blocks-2)*block_size); + for (int64_t big = mas; big < 1048576*128; big*=2) { + cout << big << std::endl; + EXPECT_EQ(alloc->reserve(big), 0); + AllocExtentVector extents; + EXPECT_EQ(big, + alloc->allocate(big, mas, 0, &extents)); + } +} + TEST_P(AllocTest, test_alloc_hint_bmap) { if (GetParam() == std::string("stupid")) { -- 2.47.3