From: Kefu Chai Date: Mon, 1 May 2017 04:28:31 +0000 (+0800) Subject: test/librbd: silence warning from -Wsign-compare X-Git-Tag: v12.0.3~150^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c83c62ea9baace942588e42b8e84c1b5fe131d18;p=ceph.git test/librbd: silence warning from -Wsign-compare Signed-off-by: Kefu Chai --- diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index 92121beab99..130a699a96b 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -664,8 +664,9 @@ TEST_F(TestInternal, ResizeCopyup) bufferlist bl; bl.append(std::string(4096, '1')); for (size_t i = 0; i < m_image_size; i += bl.length()) { - ASSERT_EQ(bl.length(), ictx->io_work_queue->write(i, bl.length(), - bufferlist{bl}, 0)); + ASSERT_EQ((ssize_t)bl.length(), + ictx->io_work_queue->write(i, bl.length(), + bufferlist{bl}, 0)); } ASSERT_EQ(0, snap_create(*ictx, "snap1")); @@ -703,7 +704,7 @@ TEST_F(TestInternal, ResizeCopyup) librbd::io::ReadResult read_result{&read_bl}; for (size_t i = 2 << order; i < m_image_size; i += bl.length()) { - ASSERT_EQ(bl.length(), + ASSERT_EQ((ssize_t)bl.length(), ictx2->io_work_queue->read(i, bl.length(), librbd::io::ReadResult{read_result}, 0)); @@ -733,8 +734,9 @@ TEST_F(TestInternal, DiscardCopyup) bufferlist bl; bl.append(std::string(4096, '1')); for (size_t i = 0; i < m_image_size; i += bl.length()) { - ASSERT_EQ(bl.length(), ictx->io_work_queue->write(i, bl.length(), - bufferlist{bl}, 0)); + ASSERT_EQ((ssize_t)bl.length(), + ictx->io_work_queue->write(i, bl.length(), + bufferlist{bl}, 0)); } ASSERT_EQ(0, snap_create(*ictx, "snap1")); @@ -769,7 +771,7 @@ TEST_F(TestInternal, DiscardCopyup) librbd::io::ReadResult read_result{&read_bl}; for (size_t i = 0; i < m_image_size; i += bl.length()) { - ASSERT_EQ(bl.length(), + ASSERT_EQ((ssize_t)bl.length(), ictx2->io_work_queue->read(i, bl.length(), librbd::io::ReadResult{read_result}, 0)); @@ -880,7 +882,7 @@ TEST_F(TestInternal, WriteFullCopyup) { bufferlist bl; bl.append(std::string(1 << ictx->order, '1')); - ASSERT_EQ(bl.length(), + ASSERT_EQ((ssize_t)bl.length(), ictx->io_work_queue->write(0, bl.length(), bufferlist{bl}, 0)); ASSERT_EQ(0, librbd::flush(ictx)); @@ -910,7 +912,7 @@ TEST_F(TestInternal, WriteFullCopyup) { bufferlist write_full_bl; write_full_bl.append(std::string(1 << ictx2->order, '2')); - ASSERT_EQ(write_full_bl.length(), + ASSERT_EQ((ssize_t)write_full_bl.length(), ictx2->io_work_queue->write(0, write_full_bl.length(), bufferlist{write_full_bl}, 0)); @@ -921,7 +923,7 @@ TEST_F(TestInternal, WriteFullCopyup) { read_bl.push_back(read_ptr); librbd::io::ReadResult read_result{&read_bl}; - ASSERT_EQ(read_bl.length(), + ASSERT_EQ((ssize_t)read_bl.length(), ictx2->io_work_queue->read(0, read_bl.length(), librbd::io::ReadResult{read_result}, 0)); ASSERT_TRUE(write_full_bl.contents_equal(read_bl)); @@ -929,7 +931,7 @@ TEST_F(TestInternal, WriteFullCopyup) { ASSERT_EQ(0, librbd::snap_set(ictx2, cls::rbd::UserSnapshotNamespace(), "snap1")); - ASSERT_EQ(read_bl.length(), + ASSERT_EQ((ssize_t)read_bl.length(), ictx2->io_work_queue->read(0, read_bl.length(), librbd::io::ReadResult{read_result}, 0)); ASSERT_TRUE(bl.contents_equal(read_bl)); diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 989b605e23b..6a07f271109 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -1846,7 +1846,7 @@ TEST_F(TestLibRBD, TestScatterGatherIO) sizeof(read_iovs) / sizeof(struct iovec), 1<wait_for_complete()); - ASSERT_EQ(bl.length(), read_comp->get_return_value()); + ASSERT_EQ((ssize_t)bl.length(), read_comp->get_return_value()); read_comp->release(); ASSERT_TRUE(bl.contents_equal(read_bl)); @@ -3863,7 +3863,7 @@ TEST_F(TestLibRBD, SnapCreateViaLockOwner) bufferlist bl; bl.append(std::string(4096, '1')); - ASSERT_EQ(bl.length(), image1.write(0, bl.length(), bl)); + ASSERT_EQ((ssize_t)bl.length(), image1.write(0, bl.length(), bl)); bool lock_owner; ASSERT_EQ(0, image1.is_exclusive_lock_owner(&lock_owner)); @@ -4647,10 +4647,10 @@ TEST_F(TestLibRBD, RebuildObjectMap) return; } - ASSERT_EQ(bl.length(), image.write(0, bl.length(), bl)); + ASSERT_EQ((ssize_t)bl.length(), image.write(0, bl.length(), bl)); ASSERT_EQ(0, image.snap_create("snap1")); - ASSERT_EQ(bl.length(), image.write(1<wait_for_complete()); - ASSERT_EQ(bl.length(), read_comp->get_return_value()); + ASSERT_EQ((ssize_t)bl.length(), read_comp->get_return_value()); read_comp->release(); bufferlist expected_bl; @@ -4889,8 +4889,8 @@ TEST_F(TestLibRBD, ExclusiveLockTransition) ASSERT_EQ(0, rbd.open(ioctx, image3, name.c_str(), NULL)); for (size_t object_no = 0; object_no < (size >> 12); ++object_no) { bufferlist read_bl; - ASSERT_EQ(bl.length(), image3.read(object_no << order, bl.length(), - read_bl)); + ASSERT_EQ((ssize_t)bl.length(), image3.read(object_no << order, bl.length(), + read_bl)); ASSERT_TRUE(bl.contents_equal(read_bl)); }