]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make block array of test_bmap_alloc self-adapting
authorxie xingguo <xie.xingguo@zte.com.cn>
Sun, 26 Jun 2016 04:07:53 +0000 (12:07 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 29 Jun 2016 04:43:32 +0000 (12:43 +0800)
So we are be able change total_blocks or zone_size flexibly and
thus append more test cases.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/test/objectstore/BitAllocator_test.cc

index 17ad153691017ea722b7e7c6fef136074b084a9a..190b40aebff6aa689de804bb5e4c8bf94fa91bef 100644 (file)
@@ -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);