]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: silence -Wsign-compare warnings 23655/head
authorKefu Chai <kchai@redhat.com>
Mon, 20 Aug 2018 17:27:30 +0000 (01:27 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 21 Aug 2018 13:41:50 +0000 (21:41 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/librados/list.cc
src/test/librados/tier.cc
src/test/objectstore/Allocator_bench.cc
src/test/objectstore/Allocator_test.cc
src/test/objectstore/store_test.cc
src/test/objectstore/test_bluestore_types.cc
src/test/osd/TestPGLog.cc

index 01c5be56d3f7fa2121f9e845fe1338743263ef41..045cd37f35b7a01c886b1463715086ed9a94601b 100644 (file)
@@ -185,7 +185,8 @@ TEST_F(LibRadosList, ListObjectsNS) {
 
   char nspace[4];
   ASSERT_EQ(-ERANGE, rados_ioctx_get_namespace(ioctx, nspace, 3));
-  ASSERT_EQ(strlen("ns2"), rados_ioctx_get_namespace(ioctx, nspace, sizeof(nspace)));
+  ASSERT_EQ(static_cast<int>(strlen("ns2")),
+           rados_ioctx_get_namespace(ioctx, nspace, sizeof(nspace)));
   ASSERT_EQ(0, strcmp("ns2", nspace));
 
   std::set<std::string> def, ns1, ns2, all;
index 408df8c9946ed0c248b2bd289a4d800c0c4f7b48..9ccbe01ea029d9dee1eedcb7224ca362fef10a62 100644 (file)
@@ -3239,7 +3239,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestRefRead) {
     } catch (buffer::error& err) {
       ASSERT_TRUE(0);
     }
-    ASSERT_EQ(1, read_ret.refs.size());
+    ASSERT_EQ(1U, read_ret.refs.size());
   }
   // chunk's refcount 
   {
@@ -3378,7 +3378,7 @@ TEST_F(LibRadosTwoPoolsPP, ManifestUnset) {
   {
     bufferlist in, out;
     cache_ioctx.exec("bar", "refcount", "chunk_read", in, out);
-    ASSERT_EQ(0, out.length());
+    ASSERT_EQ(0U, out.length());
   }
   // chunk's refcount 
   {
index 470fd32fc29384178a4aaff87c1eaa933d7f3d5c..8b6563387d6faebce6016f6bff71b0dec999fac5 100755 (executable)
@@ -150,7 +150,8 @@ TEST_P(AllocTest, test_alloc_bench_seq)
   for (uint64_t i = 0; i < capacity; i += want_size)
   {
     tmp.clear();
-    EXPECT_EQ(want_size, alloc->allocate(want_size, alloc_unit, 0, 0, &tmp));
+    EXPECT_EQ(static_cast<int64_t>(want_size),
+             alloc->allocate(want_size, alloc_unit, 0, 0, &tmp));
     if (0 == (i % (1 * 1024 * _1m))) {
       std::cout << "alloc " << i / 1024 / 1024 << " mb of "
         << capacity / 1024 / 1024 << std::endl;
index 959932af9e5980f3dc36bd1bf032da5f90401e78..8900da7dcbd049ce75cb447f743e76410ab77133 100644 (file)
@@ -241,7 +241,8 @@ TEST_P(AllocTest, test_alloc_fragmentation)
   for (size_t i = 0; i < capacity / alloc_unit; ++i)
   {
     tmp.clear();
-    EXPECT_EQ(want_size, alloc->allocate(want_size, alloc_unit, 0, 0, &tmp));
+    EXPECT_EQ(static_cast<int64_t>(want_size),
+             alloc->allocate(want_size, alloc_unit, 0, 0, &tmp));
     allocated.insert(allocated.end(), tmp.begin(), tmp.end());
 
     // bitmap fragmentation calculation doesn't provide such constant
@@ -267,7 +268,7 @@ TEST_P(AllocTest, test_alloc_fragmentation)
   }
   if (bitmap_alloc) {
     // fragmentation = one l1 slot is free + one l1 slot is partial
-    EXPECT_EQ(50, uint64_t(alloc->get_fragmentation(alloc_unit) * 100));
+    EXPECT_EQ(50U, uint64_t(alloc->get_fragmentation(alloc_unit) * 100));
   } else {
     // fragmentation approx = 257 intervals / 768 max intervals
     EXPECT_EQ(33, uint64_t(alloc->get_fragmentation(alloc_unit) * 100));
@@ -310,9 +311,10 @@ TEST_P(AllocTest, test_alloc_bug_24598)
   alloc->init_add_free(0x4900000, 0x100000);
   alloc->init_add_free(0x4b00000, 0x200000);
 
-  EXPECT_EQ(want_size, alloc->allocate(want_size, 0x100000, 0, 0, &tmp));
-  EXPECT_EQ(tmp[0].offset, 0x4b00000);
-  EXPECT_EQ(tmp[0].length, 0x200000);
+  EXPECT_EQ(static_cast<int64_t>(want_size),
+           alloc->allocate(want_size, 0x100000, 0, 0, &tmp));
+  EXPECT_EQ(tmp[0].offset, 0x4b00000U);
+  EXPECT_EQ(tmp[0].length, 0x200000U);
   EXPECT_EQ(tmp.size(), 1);
 }
 
index 67de69f1048bcde57cc2680572953f674d1fc796..57b98969653168147d5257b64acfce7cf8070963 100644 (file)
@@ -6467,7 +6467,7 @@ TEST_P(StoreTestSpecificAUSize, ExcessiveFragmentation) {
     stringify((uint64_t)2048 * 1024 * 1024).c_str());
 
   ASSERT_EQ(g_conf().get_val<Option::size_t>("bluefs_alloc_size"),
-           1024 * 1024);
+           1024 * 1024U);
 
   size_t block_size = 0x10000;
   StartDeferred(block_size);
@@ -7025,7 +7025,7 @@ TEST_P(StoreTest, BluestoreStatistics) {
   {
     bufferlist readback;
     r = store->read(ch, hoid, 0, bl.length(), readback);
-    ASSERT_EQ(r, bl.length());
+    ASSERT_EQ(static_cast<int>(bl.length()), r);
     ASSERT_TRUE(bl_eq(bl, readback));
   }
   Formatter *f = Formatter::create("store_test", "json-pretty", "json-pretty");
index 09fd4d3a6c691022ee0c9a3596043f54919d1049..1f64d770f416bc05397458a009966da0e263e717 100644 (file)
@@ -1447,7 +1447,7 @@ TEST(BlueStoreRepairer, StoreSpaceTracker)
 {
   BlueStoreRepairer::StoreSpaceTracker bmap0;
   bmap0.init((uint64_t)4096 * 1024 * 1024 * 1024, 0x1000);
-  ASSERT_EQ(bmap0.granularity, 2 * 1024 * 1024);
+  ASSERT_EQ(bmap0.granularity, 2 * 1024 * 1024U);
   ASSERT_EQ(bmap0.collections_bfs.size(), 2048 * 1024);
   ASSERT_EQ(bmap0.objects_bfs.size(), 2048 * 1024);
 
index b923dda8f788524e7fc2aa152ff2320e0e1e4750..c5340eb1e2007d6cb5f8597749e744331b590968 100644 (file)
@@ -2311,7 +2311,7 @@ public:
     ObjectStore::Transaction t2;
     t2.touch(test_coll, ghobject_t(existing_oid));
     t2.setattr(test_coll, ghobject_t(existing_oid), OI_ATTR, enc_oi);
-    ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t2)));
+    ASSERT_EQ(0, store->queue_transaction(ch, std::move(t2)));
     info.last_backfill = hobject_t::get_max();
     info.last_complete = eversion_t();
   }