From: xie xingguo Date: Sun, 26 Jun 2016 04:07:53 +0000 (+0800) Subject: os/bluestore: make block array of test_bmap_alloc self-adapting X-Git-Tag: ses5-milestone5~557^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1af00b15e13a60c3a25916b13a93afe88ad5cb6f;p=ceph.git os/bluestore: make block array of test_bmap_alloc self-adapting So we are be able change total_blocks or zone_size flexibly and thus append more test cases. Signed-off-by: xie xingguo --- diff --git a/src/test/objectstore/BitAllocator_test.cc b/src/test/objectstore/BitAllocator_test.cc index 17ad1536910..190b40aebff 100644 --- a/src/test/objectstore/BitAllocator_test.cc +++ b/src/test/objectstore/BitAllocator_test.cc @@ -390,7 +390,6 @@ TEST(BitAllocator, test_bmap_alloc) delete alloc; alloc = new BitAllocator(total_blocks, zone_size, CONCURRENT); - int64_t blocks[2048] = {0}; for (int64_t i = 0; i < alloc->size(); i++) { allocated = alloc->alloc_blocks(1, &start_block); bmap_test_assert(allocated == 1); @@ -399,6 +398,8 @@ TEST(BitAllocator, test_bmap_alloc) alloc->free_blocks(i, 1); } + int64_t blocks[alloc->size() / 2]; + memset(blocks, 0, sizeof(blocks)); allocated = alloc->alloc_blocks_dis(alloc->size()/2, blocks); bmap_test_assert(allocated == alloc->size() / 2);