diff --git a/src/test/objectstore/test_bluestore_types.cc b/src/test/objectstore/test_bluestore_types.cc index 306b8c2c517..8f39ecbfd87 100644 --- a/src/test/objectstore/test_bluestore_types.cc +++ b/src/test/objectstore/test_bluestore_types.cc @@ -338,13 +338,13 @@ TEST(Blob, put_ref) cout << b << std::endl; PExtentVector r; - b.put_ref(&coll, 0, 0x1200, &r); + ASSERT_FALSE(b.put_ref(&coll, 0, 0x1200, &r)); ASSERT_EQ(0x4200u, b.get_referenced_bytes()); cout << " r " << r << std::endl; cout << b << std::endl; r.clear(); - b.put_ref(&coll, 0xae00, 0x4200, &r); + ASSERT_TRUE(b.put_ref(&coll, 0xae00, 0x4200, &r)); ASSERT_EQ(0u, b.get_referenced_bytes()); cout << " r " << r << std::endl; cout << b << std::endl; @@ -366,7 +366,7 @@ TEST(Blob, put_ref) B.get_ref(coll.get(), 0, mas*2); ASSERT_EQ(mas * 2, B.get_referenced_bytes()); ASSERT_TRUE(b.is_allocated(0, mas*2)); - B.put_ref(coll.get(), 0, mas*2, &r); + ASSERT_TRUE(B.put_ref(coll.get(), 0, mas*2, &r)); ASSERT_EQ(0u, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -387,12 +387,12 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(123, mas * 2)); B.get_ref(coll.get(), 0, mas*2); ASSERT_EQ(mas * 2, B.get_referenced_bytes()); - B.put_ref(coll.get(), 0, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0, mas, &r)); ASSERT_EQ(mas, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*2)); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_TRUE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(0u, B.get_referenced_bytes()); ASSERT_EQ(0u, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; @@ -415,19 +415,19 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(4, mas)); B.get_ref(coll.get(), 0, mas*4); ASSERT_EQ(mas * 4, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*4)); ASSERT_TRUE(b.is_allocated(mas, mas)); - B.put_ref(coll.get(), mas*2, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas, &r)); ASSERT_EQ(mas * 2, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(mas*2, mas)); ASSERT_TRUE(b.is_allocated(0, mas*4)); - B.put_ref(coll.get(), mas*3, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*3, mas, &r)); ASSERT_EQ(mas, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(2u, r.size()); @@ -456,17 +456,17 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(6, mas)); B.get_ref(coll.get(), 0, mas*6); ASSERT_EQ(mas * 6, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 5, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*6)); - B.put_ref(coll.get(), mas*2, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas, &r)); ASSERT_EQ(mas * 4, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*6)); - B.put_ref(coll.get(), mas*3, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*3, mas, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(2u, r.size()); @@ -493,17 +493,17 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(1, mas * 6)); B.get_ref(coll.get(), 0, mas*6); ASSERT_EQ(mas * 6, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 5, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*6)); - B.put_ref(coll.get(), mas*2, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas, &r)); ASSERT_EQ(mas * 4, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*6)); - B.put_ref(coll.get(), mas*3, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*3, mas, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -528,17 +528,17 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(3, mas * 4)); B.get_ref(coll.get(), 0, mas*12); ASSERT_EQ(mas * 12, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 11, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*9, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*9, mas, &r)); ASSERT_EQ(mas * 10, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*2, mas*7, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas*7, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(3u, r.size()); @@ -567,17 +567,17 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(3, mas * 4)); B.get_ref(coll.get(), 0, mas*12); ASSERT_EQ(mas * 12, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 11, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*9, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*9, mas, &r)); ASSERT_EQ(mas * 10, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*2, mas*7, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas*7, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(3u, r.size()); @@ -594,7 +594,7 @@ TEST(Blob, put_ref) ASSERT_TRUE(b.get_extents()[0].is_valid()); ASSERT_FALSE(b.get_extents()[1].is_valid()); ASSERT_TRUE(b.get_extents()[2].is_valid()); - B.put_ref(coll.get(), 0, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0, mas, &r)); ASSERT_EQ(mas * 2, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -603,7 +603,7 @@ TEST(Blob, put_ref) ASSERT_EQ(2u, b.get_extents().size()); ASSERT_FALSE(b.get_extents()[0].is_valid()); ASSERT_TRUE(b.get_extents()[1].is_valid()); - B.put_ref(coll.get(), mas*10, mas*2, &r); + ASSERT_TRUE(B.put_ref(coll.get(), mas*10, mas*2, &r)); ASSERT_EQ(mas * 0, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -623,17 +623,17 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(3, mas * 4)); B.get_ref(coll.get(), 0, mas*12); ASSERT_EQ(mas * 12, B.get_referenced_bytes()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 11, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*9, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*9, mas, &r)); ASSERT_EQ(mas * 10, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*12)); - B.put_ref(coll.get(), mas*2, mas*7, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas*7, &r)); ASSERT_EQ(mas * 3, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(3u, r.size()); @@ -650,7 +650,7 @@ TEST(Blob, put_ref) ASSERT_TRUE(b.get_extents()[0].is_valid()); ASSERT_FALSE(b.get_extents()[1].is_valid()); ASSERT_TRUE(b.get_extents()[2].is_valid()); - B.put_ref(coll.get(), mas*10, mas*2, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*10, mas*2, &r)); ASSERT_EQ(mas * 1, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -659,7 +659,7 @@ TEST(Blob, put_ref) ASSERT_EQ(2u, b.get_extents().size()); ASSERT_TRUE(b.get_extents()[0].is_valid()); ASSERT_FALSE(b.get_extents()[1].is_valid()); - B.put_ref(coll.get(), 0, mas, &r); + ASSERT_TRUE(B.put_ref(coll.get(), 0, mas, &r)); ASSERT_EQ(mas * 0, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -677,22 +677,22 @@ TEST(Blob, put_ref) b.allocated_test(bluestore_pextent_t(1, mas * 8)); B.get_ref(coll.get(), 0, mas*8); ASSERT_EQ(mas * 8, B.get_referenced_bytes()); - B.put_ref(coll.get(), 0, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0, mas, &r)); ASSERT_EQ(mas * 7, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*8)); - B.put_ref(coll.get(), mas*7, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*7, mas, &r)); ASSERT_EQ(mas * 6, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, mas*8)); - B.put_ref(coll.get(), mas*2, mas, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*2, mas, &r)); ASSERT_EQ(mas * 5, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); ASSERT_TRUE(b.is_allocated(0, 8)); - B.put_ref(coll.get(), mas*3, mas*4, &r); + ASSERT_FALSE(B.put_ref(coll.get(), mas*3, mas*4, &r)); ASSERT_EQ(mas * 1, B.get_referenced_bytes()); ASSERT_EQ(1u, r.size()); ASSERT_EQ(0x2001u, r[0].offset); @@ -702,7 +702,7 @@ TEST(Blob, put_ref) ASSERT_EQ(2u, b.get_extents().size()); ASSERT_TRUE(b.get_extents()[0].is_valid()); ASSERT_FALSE(b.get_extents()[1].is_valid()); - B.put_ref(coll.get(), mas, mas, &r); + ASSERT_TRUE(B.put_ref(coll.get(), mas, mas, &r)); ASSERT_EQ(mas * 0, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(1u, r.size()); @@ -723,7 +723,7 @@ TEST(Blob, put_ref) B.get_ref(coll.get(), 0, mas*4); ASSERT_EQ(mas * 4, B.get_referenced_bytes()); ASSERT_TRUE(b.is_allocated(0, mas*4)); - B.put_ref(coll.get(), 0, mas*3, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0, mas*3, &r)); ASSERT_EQ(mas * 1, B.get_referenced_bytes()); cout << "r " << r << " " << b << std::endl; ASSERT_EQ(0u, r.size()); @@ -749,7 +749,7 @@ TEST(Blob, put_ref) cout << "before: " << B << std::endl; PExtentVector r; - B.put_ref(coll.get(), 0x1800, 0x2000, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0x1800, 0x2000, &r)); ASSERT_EQ(0x3800u + 0x6400u - 0x2000u, B.get_referenced_bytes()); cout << "after: " << B << std::endl; cout << "r " << r << std::endl; @@ -765,7 +765,7 @@ TEST(Blob, put_ref) ASSERT_EQ(0xa000u, B.get_referenced_bytes()); cout << "before: " << B << std::endl; PExtentVector r; - B.put_ref(coll.get(), 0x8000, 0x2000, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0x8000, 0x2000, &r)); cout << "after: " << B << std::endl; cout << "r " << r << std::endl; ASSERT_EQ(0x8000u, B.get_referenced_bytes()); @@ -784,7 +784,7 @@ TEST(Blob, put_ref) ASSERT_EQ(0xe000u, B.get_referenced_bytes()); cout << "before: " << B << std::endl; PExtentVector r; - B.put_ref(coll.get(), 0, 0xb000, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0, 0xb000, &r)); ASSERT_EQ(0x3000u, B.get_referenced_bytes()); cout << "after: " << B << std::endl; cout << "r " << r << std::endl; @@ -811,7 +811,7 @@ TEST(Blob, put_ref) ASSERT_EQ(0xc000u, B.get_referenced_bytes()); cout << "before: " << B << std::endl; PExtentVector r; - B.put_ref(coll.get(), 0x2000, 0xa000, &r); + ASSERT_FALSE(B.put_ref(coll.get(), 0x2000, 0xa000, &r)); cout << "after: " << B << std::endl; cout << "r " << r << std::endl; ASSERT_EQ(0x2000u, B.get_referenced_bytes());