]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/objectstore: handle -ENOSPC returned by allocate() 38177/head
authorjhonxue <jhonxue@tencent.com>
Thu, 19 Nov 2020 04:38:02 +0000 (12:38 +0800)
committerjhonxue <jhonxue@tencent.com>
Fri, 20 Nov 2020 09:29:57 +0000 (17:29 +0800)
Fixes: https://tracker.ceph.com/issues/48288
Signed-off-by: Xue Yantao <jhonxue@tencent.com>
src/test/objectstore/Allocator_test.cc

index 78e018b7a57e1a82a4f3a0c662526b442d5ba9ad..21e7318889a6e7eb648ce241ed23f986e6610acb 100644 (file)
@@ -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);