]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: use StrEq for C-style string matching 7914/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 10 Feb 2016 18:44:51 +0000 (13:44 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 3 Mar 2016 21:44:10 +0000 (16:44 -0500)
If compiler optimizations are enabled, strings will be copied,
resulting in different memory addresses.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
18 files changed:
src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc
src/test/librbd/exclusive_lock/test_mock_ReleaseRequest.cc
src/test/librbd/image/test_mock_RefreshRequest.cc
src/test/librbd/object_map/test_mock_InvalidateRequest.cc
src/test/librbd/object_map/test_mock_LockRequest.cc
src/test/librbd/object_map/test_mock_RefreshRequest.cc
src/test/librbd/object_map/test_mock_ResizeRequest.cc
src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc
src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc
src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc
src/test/librbd/object_map/test_mock_UnlockRequest.cc
src/test/librbd/object_map/test_mock_UpdateRequest.cc
src/test/librbd/operation/test_mock_ResizeRequest.cc
src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc
src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc
src/test/librbd/test_mock_fixture.cc

index 0d370ac1d957e58407eb9377db1cdf047727d1d2..60b4c5a5e6a4dd2b2f803d409bf898afc2a2e00d 100644 (file)
@@ -28,6 +28,7 @@ using ::testing::DoAll;
 using ::testing::InSequence;
 using ::testing::Return;
 using ::testing::SetArgPointee;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 static const std::string TEST_COOKIE("auto 123");
@@ -45,7 +46,7 @@ public:
 
   void expect_lock(MockImageCtx &mock_image_ctx, int r) {
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                exec(mock_image_ctx.header_oid, _, "lock", "lock", _, _, _))
+                exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("lock"), _, _, _))
                   .WillOnce(Return(r));
   }
 
@@ -86,8 +87,8 @@ public:
                             const std::string &lock_tag,
                             ClsLockType lock_type) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "lock",
-                               "get_info", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+                               StrEq("get_info"), _, _, _));
     if (r < 0 && r != -ENOENT) {
       expect.WillOnce(Return(r));
     } else {
@@ -138,7 +139,7 @@ public:
 
   void expect_break_lock(MockImageCtx &mock_image_ctx, int r) {
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                exec(mock_image_ctx.header_oid, _, "lock", "break_lock", _, _, _))
+                exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _))
                   .WillOnce(Return(r));
   }
 
index 925d1f2171f8559371bd0aa00c361eea41b2c7fb..eb42feb715ffd0e148823d711169b20406607590 100644 (file)
@@ -22,6 +22,7 @@ namespace exclusive_lock {
 using ::testing::_;
 using ::testing::InSequence;
 using ::testing::Return;
+using ::testing::StrEq;
 
 static const std::string TEST_COOKIE("auto 123");
 
@@ -60,7 +61,7 @@ public:
 
   void expect_unlock(MockImageCtx &mock_image_ctx, int r) {
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                exec(mock_image_ctx.header_oid, _, "lock", "unlock", _, _, _))
+                exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("unlock"), _, _, _))
                   .WillOnce(Return(r));
   }
 
index f5ee743d1c5723a3415ca6939c9a98025047dcd8..e362986ac632cefd77f15aaf91bf118f2adc4d9e 100644 (file)
@@ -88,6 +88,7 @@ using ::testing::DoDefault;
 using ::testing::InSequence;
 using ::testing::Return;
 using ::testing::WithArg;
+using ::testing::StrEq;
 
 class TestMockImageRefreshRequest : public TestMockFixture {
 public:
@@ -114,7 +115,7 @@ public:
 
   void expect_v1_get_snapshots(MockRefreshImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd", "snap_list", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("snap_list"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
@@ -124,7 +125,7 @@ public:
 
   void expect_v1_get_locks(MockRefreshImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "lock", "get_info", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
@@ -134,29 +135,29 @@ public:
 
   void expect_get_mutable_metadata(MockRefreshImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd", "get_size", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
       expect.WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_features", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_features"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_snapcontext", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapcontext"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_parent", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "lock", "get_info", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
 
   void expect_get_flags(MockRefreshImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd", "get_flags", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_flags"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
@@ -166,19 +167,19 @@ public:
 
   void expect_get_snapshots(MockRefreshImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd", "get_snapshot_name", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapshot_name"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
       expect.WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_size", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_parent", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "get_protection_status", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_protection_status"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
index 9f20a4799dc8ddc02bc158606a0deec523220dbd..4f3831cf05953c4612144601c68dbe2afc3a5074 100644 (file)
@@ -15,6 +15,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapInvalidateRequest : public TestMockFixture {
 public:
@@ -31,7 +32,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesInMemoryFlag) {
   AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
 
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+              exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                 .Times(0);
 
   {
@@ -55,10 +56,10 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesHeadOnDiskFlag) {
   AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
 
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+              exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                 .WillOnce(DoDefault());
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+              exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                 .WillOnce(DoDefault());
 
   {
@@ -85,10 +86,10 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesSnapOnDiskFlag) {
                                                 &cond_ctx);
 
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+              exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                 .Times(0);
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+              exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                 .WillOnce(DoDefault());
 
   {
@@ -109,7 +110,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, SkipOnDiskUpdateWithoutLock) {
   AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
 
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+              exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                 .Times(0);
 
   {
@@ -133,10 +134,10 @@ TEST_F(TestMockObjectMapInvalidateRequest, IgnoresOnDiskUpdateFailure) {
   AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
 
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+              exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                 .WillOnce(DoDefault());
   EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-              exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+              exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                 .WillOnce(Return(-EINVAL));
 
   {
index e7a62fd3c663647f859c206181ac1d75bf364240..0ee782bce133740e03746c5d7297d02a730d1eea 100644 (file)
@@ -19,6 +19,7 @@ using ::testing::_;
 using ::testing::DoAll;
 using ::testing::InSequence;
 using ::testing::Return;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockObjectMapLockRequest : public TestMockFixture {
@@ -28,14 +29,14 @@ public:
   void expect_lock(MockImageCtx &mock_image_ctx, int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, CEPH_NOSNAP));
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                exec(oid, _, "lock", "lock", _, _, _))
+                exec(oid, _, StrEq("lock"), StrEq("lock"), _, _, _))
                   .WillOnce(Return(r));
   }
 
   void expect_get_lock_info(MockImageCtx &mock_image_ctx, int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, CEPH_NOSNAP));
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(oid, _, "lock", "get_info", _, _, _));
+                               exec(oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
@@ -60,7 +61,7 @@ public:
   void expect_break_lock(MockImageCtx &mock_image_ctx, int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, CEPH_NOSNAP));
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(oid, _, "lock", "break_lock", _, _, _));
+                               exec(oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
index 9daa18c0bfc78a4261e509bf5ad048efd7487972..0dfbb4c07d6fe792fbfb31a79185aa291fb00641 100644 (file)
@@ -65,6 +65,7 @@ using ::testing::DoAll;
 using ::testing::DoDefault;
 using ::testing::InSequence;
 using ::testing::Return;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockObjectMapRefreshRequest : public TestMockFixture {
@@ -87,7 +88,7 @@ public:
                               int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, snap_id));
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(oid, _, "rbd", "object_map_load", _, _, _));
+                               exec(oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
@@ -125,7 +126,7 @@ public:
                                 uint64_t num_objects, int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, TEST_SNAP_ID));
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(oid, _, "rbd", "object_map_resize", _, _, _));
+                               exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _));
     expect.WillOnce(Return(r));
   }
 
index f21d645f81b36d1438dc5439b3041cffdbbdf323..42007d34487a44cddb58ccb585b1a0186769452e 100644 (file)
@@ -17,6 +17,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapResizeRequest : public TestMockFixture {
 public:
@@ -24,26 +25,26 @@ public:
     std::string oid(ObjectMap::object_map_name(ictx->id, snap_id));
     if (snap_id == CEPH_NOSNAP) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(DoDefault());
     }
 
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_resize", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
                     .WillOnce(Return(r));
     } else {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_resize", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
 
   void expect_invalidate(librbd::ImageCtx *ictx) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _)).Times(0);
+                exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _)).Times(0);
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+                exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                   .WillOnce(DoDefault());
   }
 };
index e76c1927de2dc329acc8c946dcfdeb6924e5a2aa..3dd62989f2970bc70418333278f9e5bae6775726 100644 (file)
@@ -17,6 +17,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapSnapshotCreateRequest : public TestMockFixture {
 public:
@@ -57,21 +58,21 @@ public:
     std::string oid(ObjectMap::object_map_name(ictx->id, CEPH_NOSNAP));
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(Return(r));
     } else {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_snap_add", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_add"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
 
   void expect_invalidate(librbd::ImageCtx *ictx) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+                exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                   .WillOnce(DoDefault());
   }
 };
index a29699e86fdf918ce5d4512f1953cd1d6cabbcaa..e7b438d1b78dd18cd0499515407a91cf6ed62919 100644 (file)
@@ -18,6 +18,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapSnapshotRemoveRequest : public TestMockFixture {
 public:
@@ -25,11 +26,11 @@ public:
     std::string snap_oid(ObjectMap::object_map_name(ictx->id, snap_id));
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(snap_oid, _, "rbd", "object_map_load", _, _, _))
+                  exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
                     .WillOnce(Return(r));
     } else {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(snap_oid, _, "rbd", "object_map_load", _, _, _))
+                  exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
@@ -38,14 +39,14 @@ public:
     std::string oid(ObjectMap::object_map_name(ictx->id, CEPH_NOSNAP));
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(Return(r));
     } else {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(DoDefault());
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_snap_remove", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_remove"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
@@ -63,10 +64,10 @@ public:
 
   void expect_invalidate(librbd::ImageCtx *ictx) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+                exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                   .Times(0);
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+                exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                   .WillOnce(DoDefault());
   }
 };
index 2465ffd5f26839f49d510ee28b2ddfa1e3c752dc..51fc932c0b07a9a3cda97fa88068f342d6193d0d 100644 (file)
@@ -17,6 +17,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapSnapshotRollbackRequest : public TestMockFixture {
 public:
@@ -35,7 +36,7 @@ public:
   void expect_write_map(librbd::ImageCtx *ictx, int r) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
                 exec(ObjectMap::object_map_name(ictx->id, CEPH_NOSNAP), _,
-                    "lock", "assert_locked", _, _, _))
+                    StrEq("lock"), StrEq("assert_locked"), _, _, _))
                   .WillOnce(DoDefault());
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
@@ -52,10 +53,10 @@ public:
 
   void expect_invalidate(librbd::ImageCtx *ictx, uint32_t times) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+                exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                   .Times(0);
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+                exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                   .Times(times)
                   .WillRepeatedly(DoDefault());
   }
index 4cd2db46cc9272119125ee1711b38512742f35e6..7f834ca8dba1827e19696979277f23d912665ae7 100644 (file)
@@ -18,6 +18,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::InSequence;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapUnlockRequest : public TestMockFixture {
 public:
@@ -26,7 +27,7 @@ public:
   void expect_unlock(MockImageCtx &mock_image_ctx, int r) {
     std::string oid(ObjectMap::object_map_name(mock_image_ctx.id, CEPH_NOSNAP));
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                exec(oid, _, "lock", "unlock", _, _, _))
+                exec(oid, _, StrEq("lock"), StrEq("unlock"), _, _, _))
                   .WillOnce(Return(r));
   }
 };
index 0d7dffad5b7fd91b3952afb75dcf4f5073374522..45879f2f83e608d99dd57337d3aa193bf93e177e 100644 (file)
@@ -18,6 +18,7 @@ namespace object_map {
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 
 class TestMockObjectMapUpdateRequest : public TestMockFixture {
 public:
@@ -25,27 +26,27 @@ public:
     std::string oid(ObjectMap::object_map_name(ictx->id, snap_id));
     if (snap_id == CEPH_NOSNAP) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "lock", "assert_locked", _, _, _))
+                  exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                     .WillOnce(DoDefault());
     }
 
     if (r < 0) {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_update", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_update"), _, _, _))
                     .WillOnce(Return(r));
     } else {
       EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                  exec(oid, _, "rbd", "object_map_update", _, _, _))
+                  exec(oid, _, StrEq("rbd"), StrEq("object_map_update"), _, _, _))
                     .WillOnce(DoDefault());
     }
   }
 
   void expect_invalidate(librbd::ImageCtx *ictx) {
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "lock", "assert_locked", _, _, _))
+                exec(ictx->header_oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
                   .Times(0);
     EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
-                exec(ictx->header_oid, _, "rbd", "set_flags", _, _, _))
+                exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
                   .WillOnce(DoDefault());
   }
 };
index dfe07bf25736b17590396984c24ee23f196b8962..34b0debde8b29ab0b4b8380e858232ba2190ae42 100644 (file)
@@ -53,6 +53,7 @@ using ::testing::_;
 using ::testing::DoAll;
 using ::testing::InSequence;
 using ::testing::Return;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockOperationResizeRequest : public TestMockFixture {
@@ -104,7 +105,7 @@ public:
         EXPECT_CALL(*mock_image_ctx.exclusive_lock, assert_header_locked(_));
       }
       EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                  exec(mock_image_ctx.header_oid, _, "rbd", "set_size", _, _, _))
+                  exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("set_size"), _, _, _))
                     .WillOnce(Return(r));
     }
   }
index 96fe0cdadff54bccb1f1a9bf70425e128d8e79c4..8cc5fda42cfa873b921bb7b12f4a6ba152752cca 100644 (file)
@@ -23,6 +23,7 @@ using ::testing::DoAll;
 using ::testing::DoDefault;
 using ::testing::Return;
 using ::testing::SetArgPointee;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockOperationSnapshotCreateRequest : public TestMockFixture {
@@ -69,9 +70,9 @@ public:
     }
 
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd",
-                               mock_image_ctx.old_format ? "snap_add" :
-                                                           "snapshot_add",
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+                               StrEq(mock_image_ctx.old_format ? "snap_add" :
+                                                                 "snapshot_add"),
                                _, _, _));
     if (r == -ESTALE) {
       expect.WillOnce(Return(r)).WillOnce(DoDefault());
index ab7a8e485eeadcd0b0cdb3253606529af363fcb6..22c02939d0592dc521e04af45129f78d42f95a48 100644 (file)
@@ -23,6 +23,7 @@ using ::testing::DoAll;
 using ::testing::DoDefault;
 using ::testing::Return;
 using ::testing::SetArgPointee;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockOperationSnapshotProtectRequest : public TestMockFixture {
@@ -46,8 +47,8 @@ public:
 
   void expect_set_protection_status(MockImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd",
-                                    "set_protection_status", _, _, _));
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+                                    StrEq("set_protection_status"), _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
     } else {
index fc1fe2a9cdb9fb4f484fa012fe3d4a9bfa2deac4..4dcf3c8b44f355b70fb906be8d121850b030fb84 100644 (file)
@@ -23,6 +23,7 @@ using ::testing::DoAll;
 using ::testing::DoDefault;
 using ::testing::Return;
 using ::testing::SetArgPointee;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockOperationSnapshotRemoveRequest : public TestMockFixture {
@@ -71,7 +72,7 @@ public:
   void expect_remove_child(MockImageCtx &mock_image_ctx, int r) {
     bool deep_flatten = mock_image_ctx.image_ctx->test_features(RBD_FEATURE_DEEP_FLATTEN);
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(RBD_CHILDREN, _, "rbd", "remove_child",_,
+                               exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("remove_child"), _,
                                     _, _));
     if (deep_flatten) {
       expect.Times(0);
@@ -93,9 +94,9 @@ public:
 
   void expect_snap_remove(MockImageCtx &mock_image_ctx, int r) {
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd",
-                               mock_image_ctx.old_format ? "snap_remove" :
-                                                           "snapshot_remove",
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+                               StrEq(mock_image_ctx.old_format ? "snap_remove" :
+                                                                  "snapshot_remove"),
                                 _, _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
index 4d437d0eae254229d14eb9cf3d40d3839a67ed1f..b3120274a1c9e0055e4c52d7d7d8f99706b7b5f9 100644 (file)
@@ -26,6 +26,7 @@ using ::testing::DoDefault;
 using ::testing::Return;
 using ::testing::SetArgReferee;
 using ::testing::SetArgPointee;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 class TestMockOperationSnapshotUnprotectRequest : public TestMockFixture {
@@ -54,8 +55,8 @@ public:
     ::encode(status, bl);
 
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(mock_image_ctx.header_oid, _, "rbd",
-                                    "set_protection_status", ContentsEqual(bl),
+                               exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+                                    StrEq("set_protection_status"), ContentsEqual(bl),
                                     _, _));
     if (r < 0) {
       expect.WillOnce(Return(r));
@@ -89,7 +90,7 @@ public:
     ::encode(children, bl);
 
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
-                               exec(RBD_CHILDREN, _, "rbd", "get_children", _,
+                               exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("get_children"), _,
                                _, _));
     if (r < 0) {
       expect.WillRepeatedly(Return(r));
index 363e7166d55237b90386dc4c8d7a1b9ef621e3aa..cbd621b4c0de5c79ef5083301dfc63c2de254f0c 100644 (file)
@@ -20,6 +20,7 @@ template class librbd::operation::Request<librbd::MockImageCtx>;
 using ::testing::_;
 using ::testing::DoDefault;
 using ::testing::Return;
+using ::testing::StrEq;
 using ::testing::WithArg;
 
 TestMockFixture::TestRadosClientPtr TestMockFixture::s_test_rados_client;
@@ -57,7 +58,7 @@ void TestMockFixture::TearDown() {
 
 void TestMockFixture::expect_unlock_exclusive_lock(librbd::ImageCtx &ictx) {
   EXPECT_CALL(get_mock_io_ctx(ictx.md_ctx),
-              exec(_, _, "lock", "unlock", _, _, _))
+              exec(_, _, StrEq("lock"), StrEq("unlock"), _, _, _))
                 .WillRepeatedly(DoDefault());
 }