]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: move get_mock_io_ctx helper method to common location
authorJason Dillaman <dillaman@redhat.com>
Thu, 10 Mar 2016 02:10:50 +0000 (21:10 -0500)
committerJason Dillaman <dillaman@redhat.com>
Sun, 13 Mar 2016 03:40:15 +0000 (22:40 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librados_test_stub/LibradosTestStub.cc
src/test/librados_test_stub/LibradosTestStub.h
src/test/librbd/test_mock_fixture.cc
src/test/librbd/test_mock_fixture.h
src/test/rbd_mirror/test_mock_fixture.cc
src/test/rbd_mirror/test_mock_fixture.h

index 8df054775d0d099879862b6e414b0a0b5917d6cb..ad6b395199a242aa5f47a6828a2610caf831a6b5 100644 (file)
@@ -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<MockTestMemIoCtxImpl **>(&ioctx);
+  return **mock;
+}
+
+}
+
 namespace librados_test_stub {
 
 TestRadosClientPtr *rados_client() {
index 9fed68df24b2872095bc1699256003b6ae0b9997..4432ec30e5c4f0b215da3c61b721da5d2c611eaa 100644 (file)
@@ -7,7 +7,11 @@
 #include <boost/shared_ptr.hpp>
 
 namespace librados {
+class IoCtx;
 class TestRadosClient;
+class MockTestMemIoCtxImpl;
+
+MockTestMemIoCtxImpl &get_mock_io_ctx(IoCtx &ioctx);
 }
 
 namespace librados_test_stub {
index cbd621b4c0de5c79ef5083301dfc63c2de254f0c..4cc940cad47d306ce073a0caf9ccc92465d22a54 100644 (file)
@@ -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<librados::MockTestMemIoCtxImpl **>(&ioctx);
-  return **mock;
-}
-
 void TestMockFixture::initialize_features(librbd::ImageCtx *ictx,
                                           librbd::MockImageCtx &mock_image_ctx,
                                           librbd::MockExclusiveLock &mock_exclusive_lock,
index ce3e6d5abb1761b9d5dd34692345678fe987b9d5..bd5a2ac84c686fb73e4ea5202b523391a9c4aa2c 100644 (file)
@@ -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 <boost/shared_ptr.hpp>
 #include <gmock/gmock.h>
@@ -69,7 +70,6 @@ public:
   ::testing::NiceMock<librados::MockTestMemRadosClient> &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);
index e64297bb3bec34ccf799a8078a5d5ee41c52d70a..0863c40b909da234871b278138e4ecfe6196bb69 100644 (file)
@@ -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<librados::MockTestMemIoCtxImpl **>(&ioctx);
-  return **mock;
-}
-
 } // namespace mirror
 } // namespace rbd
 
index 1609c945f805a42a6cb795ca4799b88a29440898..2231095936b13b77f20e9c650457a724edc5c319 100644 (file)
@@ -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 <boost/shared_ptr.hpp>
 #include <gmock/gmock.h>
 
@@ -34,7 +35,6 @@ public:
   ::testing::NiceMock<librados::MockTestMemRadosClient> &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;