From: Jason Dillaman Date: Thu, 10 Mar 2016 02:10:50 +0000 (-0500) Subject: test: move get_mock_io_ctx helper method to common location X-Git-Tag: v10.1.0~104^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1d4d4c8bf4ff415c29d7dac6f947a258e429e995;p=ceph.git test: move get_mock_io_ctx helper method to common location Signed-off-by: Jason Dillaman --- diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index 8df054775d0d..ad6b395199a2 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -66,6 +66,16 @@ void do_out_buffer(string& outbl, char **outbuf, size_t *outbuflen) { } // anonymous namespace +namespace librados { + +MockTestMemIoCtxImpl &get_mock_io_ctx(IoCtx &ioctx) { + MockTestMemIoCtxImpl **mock = + reinterpret_cast(&ioctx); + return **mock; +} + +} + namespace librados_test_stub { TestRadosClientPtr *rados_client() { diff --git a/src/test/librados_test_stub/LibradosTestStub.h b/src/test/librados_test_stub/LibradosTestStub.h index 9fed68df24b2..4432ec30e5c4 100644 --- a/src/test/librados_test_stub/LibradosTestStub.h +++ b/src/test/librados_test_stub/LibradosTestStub.h @@ -7,7 +7,11 @@ #include namespace librados { +class IoCtx; class TestRadosClient; +class MockTestMemIoCtxImpl; + +MockTestMemIoCtxImpl &get_mock_io_ctx(IoCtx &ioctx); } namespace librados_test_stub { diff --git a/src/test/librbd/test_mock_fixture.cc b/src/test/librbd/test_mock_fixture.cc index cbd621b4c0de..4cc940cad47d 100644 --- a/src/test/librbd/test_mock_fixture.cc +++ b/src/test/librbd/test_mock_fixture.cc @@ -68,14 +68,6 @@ void TestMockFixture::expect_op_work_queue(librbd::MockImageCtx &mock_image_ctx) mock_image_ctx.image_ctx->op_work_queue)); } -librados::MockTestMemIoCtxImpl &TestMockFixture::get_mock_io_ctx( - librados::IoCtx &ioctx) { - // TODO become friend of IoCtx so that we can cleanly extract io_ctx_impl - librados::MockTestMemIoCtxImpl **mock = - reinterpret_cast(&ioctx); - return **mock; -} - void TestMockFixture::initialize_features(librbd::ImageCtx *ictx, librbd::MockImageCtx &mock_image_ctx, librbd::MockExclusiveLock &mock_exclusive_lock, diff --git a/src/test/librbd/test_mock_fixture.h b/src/test/librbd/test_mock_fixture.h index ce3e6d5abb17..bd5a2ac84c68 100644 --- a/src/test/librbd/test_mock_fixture.h +++ b/src/test/librbd/test_mock_fixture.h @@ -6,6 +6,7 @@ #include "test/librbd/test_fixture.h" #include "test/librbd/mock/MockImageCtx.h" +#include "test/librados_test_stub/LibradosTestStub.h" #include "common/WorkQueue.h" #include #include @@ -69,7 +70,6 @@ public: ::testing::NiceMock &get_mock_rados_client() { return *s_mock_rados_client; } - librados::MockTestMemIoCtxImpl &get_mock_io_ctx(librados::IoCtx &ioctx); void expect_op_work_queue(librbd::MockImageCtx &mock_image_ctx); void expect_unlock_exclusive_lock(librbd::ImageCtx &ictx); diff --git a/src/test/rbd_mirror/test_mock_fixture.cc b/src/test/rbd_mirror/test_mock_fixture.cc index e64297bb3bec..0863c40b909d 100644 --- a/src/test/rbd_mirror/test_mock_fixture.cc +++ b/src/test/rbd_mirror/test_mock_fixture.cc @@ -41,13 +41,6 @@ void TestMockFixture::TearDown() { s_mock_rados_client->default_to_dispatch(); } -librados::MockTestMemIoCtxImpl &TestMockFixture::get_mock_io_ctx( - librados::IoCtx &ioctx) { - librados::MockTestMemIoCtxImpl **mock = - reinterpret_cast(&ioctx); - return **mock; -} - } // namespace mirror } // namespace rbd diff --git a/src/test/rbd_mirror/test_mock_fixture.h b/src/test/rbd_mirror/test_mock_fixture.h index 1609c945f805..2231095936b1 100644 --- a/src/test/rbd_mirror/test_mock_fixture.h +++ b/src/test/rbd_mirror/test_mock_fixture.h @@ -5,6 +5,7 @@ #define CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H #include "test/rbd_mirror/test_fixture.h" +#include "test/librados_test_stub/LibradosTestStub.h" #include #include @@ -34,7 +35,6 @@ public: ::testing::NiceMock &get_mock_rados_client() { return *s_mock_rados_client; } - librados::MockTestMemIoCtxImpl &get_mock_io_ctx(librados::IoCtx &ioctx); private: static TestRadosClientPtr s_test_rados_client;