]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/bufferlist: assert the rebuild in rebuild_aligned_size_and_memory() actually... 44675/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 19 Jan 2022 21:56:05 +0000 (21:56 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 19 Jan 2022 22:06:21 +0000 (22:06 +0000)
For the investigation of failures like the following one:

```
[ RUN      ] BufferList.rebuild_aligned_size_and_memory
../src/test/bufferlist.cc:1865: Failure
Expected equality of these values:
  bl.get_num_buffers()
    Which is: 2
  1
[  FAILED  ] BufferList.rebuild_aligned_size_and_memory (0 ms)
```

The test case assumes the rebuild before the failed clause **always**
happens while `bufferlist::rebuild_aligned_size_and_memory()` skips it
if buffers are already aligned.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/test/bufferlist.cc

index cf182f01748ba02f5e311e4721c247167bc166ea..99e954ff59711c87610193e2a4687db2981dee8e 100644 (file)
@@ -1860,8 +1860,9 @@ TEST(BufferList, rebuild_aligned_size_and_memory) {
     bl.append(ptr, 0, 0);
     EXPECT_EQ(bl.get_num_buffers(), 2);
     EXPECT_EQ(bl.back().length(), 0);
-    /* rebuild_aligned() calls rebuild_aligned_size_and_memory() */
-    bl.rebuild_aligned(4096);
+    /* rebuild_aligned() calls rebuild_aligned_size_and_memory().
+     * we assume the rebuild always happens. */
+    EXPECT_TRUE(bl.rebuild_aligned(4096));
     EXPECT_EQ(bl.get_num_buffers(), 1);
   }
 }