From ad10d615e60fdd617a716233d140d8661ecb6ab1 Mon Sep 17 00:00:00 2001 From: wangzhengyong Date: Mon, 12 Jun 2017 21:24:38 +0800 Subject: [PATCH] test/librbd: add Mock Image cache for compare_and_write Signed-off-by: Zhengyong Wang --- src/test/librbd/mock/cache/MockImageCache.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/librbd/mock/cache/MockImageCache.h b/src/test/librbd/mock/cache/MockImageCache.h index 8c5624c8659..473f7c8a8b8 100644 --- a/src/test/librbd/mock/cache/MockImageCache.h +++ b/src/test/librbd/mock/cache/MockImageCache.h @@ -36,6 +36,18 @@ struct MockImageCache { int fadvise_flags, Context *on_finish) { aio_writesame_mock(off, len, bl, fadvise_flags, on_finish); } + + MOCK_METHOD6(aio_compare_and_write_mock, void(const Extents &, + const ceph::bufferlist &, + const ceph::bufferlist &, + uint64_t *, int, Context *)); + + void aio_compare_and_write(Extents&& image_extents, ceph::bufferlist&& cmp_bl, + ceph::bufferlist&& bl, uint64_t *mismatch_offset, + int fadvise_flags, Context *on_finish) { + aio_compare_and_write_mock(image_extents, cmp_bl, bl, mismatch_offset, + fadvise_flags, on_finish); + } }; } // namespace cache -- 2.39.5