From: Kefu Chai Date: Thu, 3 Sep 2015 17:23:31 +0000 (+0800) Subject: test/bufferlist: do not expect !is_page_aligned() after unaligned rebuild X-Git-Tag: v0.94.7~7^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=744e9f837a94f95c5e877f074fd1479f8da64e3c;p=ceph.git 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) --- 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;