From 744e9f837a94f95c5e877f074fd1479f8da64e3c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 4 Sep 2015 01:23:31 +0800 Subject: [PATCH] test/bufferlist: do not expect !is_page_aligned() after unaligned rebuild if the size of a bufferlist is page aligned we allocate page aligned memory chunk for it when rebuild() is called. otherwise we just call the plain new() to allocate new memory chunk for holding the continuous buffer. but we should not expect that `new` allocator always returns unaligned memory chunks. instead, it *could* return page aligned memory chunk as long as the allocator feels appropriate. so, the `EXPECT_FALSE(bl.is_page_aligned())` after the `rebuild()` call is removed. Signed-off-by: Kefu Chai (cherry picked from commit 8ed724222651812c2ee8cc3804dc1f54c973897d) --- src/test/bufferlist.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index 3c8d0473bae23..6ea987b0c3d43 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -1403,12 +1403,15 @@ TEST(BufferList, rebuild) { { bufferlist bl; bufferptr ptr(buffer::create_page_aligned(2)); + ptr[0] = 'X'; + ptr[1] = 'Y'; ptr.set_offset(1); ptr.set_length(1); bl.append(ptr); EXPECT_FALSE(bl.is_page_aligned()); bl.rebuild(); - EXPECT_FALSE(bl.is_page_aligned()); + EXPECT_EQ(1U, bl.length()); + EXPECT_EQ('Y', *bl.begin()); } { bufferlist bl; -- 2.39.5