From: jhonxue Date: Thu, 19 Nov 2020 04:38:02 +0000 (+0800) Subject: test/objectstore: handle -ENOSPC returned by allocate() X-Git-Tag: v16.1.0~535^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38177%2Fhead;p=ceph.git test/objectstore: handle -ENOSPC returned by allocate() Fixes: https://tracker.ceph.com/issues/48288 Signed-off-by: Xue Yantao --- diff --git a/src/test/objectstore/Allocator_test.cc b/src/test/objectstore/Allocator_test.cc index 78e018b7a57e..21e7318889a6 100644 --- a/src/test/objectstore/Allocator_test.cc +++ b/src/test/objectstore/Allocator_test.cc @@ -341,12 +341,14 @@ TEST_P(AllocTest, test_dump_fragmentation_score) //allocate want_size = ( rng() % one_alloc_max ) / alloc_unit * alloc_unit + alloc_unit; tmp.clear(); - uint64_t r = alloc->allocate(want_size, alloc_unit, 0, 0, &tmp); - for (auto& t: tmp) { - if (t.length > 0) - allocated.push_back(t); - } - allocated_cnt += r; + int64_t r = alloc->allocate(want_size, alloc_unit, 0, 0, &tmp); + if (r > 0) { + for (auto& t: tmp) { + if (t.length > 0) + allocated.push_back(t); + } + allocated_cnt += r; + } } else { //free ceph_assert(allocated.size() > 0);