Skip to content

Commit

Permalink
Merge pull request ceph#44706 from rzarzynski/wip-tests-bl-fix-rebuild
Browse files Browse the repository at this point in the history
test/bufferlist: ensure rebuild_aligned_size_and_memory() always rebuilds.

Reviewed-by: Yingxin Cheng <[email protected]>
Reviewed-by: Ilya Dryomov <[email protected]>
Reviewed-by: Neha Ojha <[email protected]>
  • Loading branch information
neha-ojha authored Jan 21, 2022
2 parents a9b3e2f + 88176ac commit 87a490d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/test/bufferlist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1853,13 +1853,14 @@ TEST(BufferList, rebuild_aligned_size_and_memory) {
* scenario where the first bptr is both size and memory aligned and
* the second is 0-length */
bl.clear();
bufferptr ptr1(buffer::create_aligned(4096, 4096));
bl.append(ptr1);
bufferptr ptr(10);
/* bl.back().length() must be 0 */
bl.append(ptr, 0, 0);
bl.append(bufferptr{buffer::create_aligned(4096, 4096)});
bufferptr ptr(buffer::create_aligned(42, 4096));
/* bl.back().length() must be 0. offset set to 42 guarantees
* the entire list is unaligned. */
bl.append(ptr, 42, 0);
EXPECT_EQ(bl.get_num_buffers(), 2);
EXPECT_EQ(bl.back().length(), 0);
EXPECT_FALSE(bl.is_aligned(4096));
/* rebuild_aligned() calls rebuild_aligned_size_and_memory().
* we assume the rebuild always happens. */
EXPECT_TRUE(bl.rebuild_aligned(4096));
Expand Down

0 comments on commit 87a490d

Please sign in to comment.