]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rados-api/io.cc: test WriteFullRoundTripPP
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 11 Aug 2011 18:19:44 +0000 (11:19 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 11 Aug 2011 18:19:44 +0000 (11:19 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/test/rados-api/io.cc

index d827463ec536c001af41350506a43e9b08d0501d..5168c130b15c6476102648fb58d376caec31f63b 100644 (file)
@@ -136,6 +136,29 @@ TEST(LibRadosIo, WriteFullRoundTrip) {
   ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster));
 }
 
+TEST(LibRadosIo, WriteFullRoundTripPP) {
+  char buf[128];
+  char buf2[64];
+  Rados cluster;
+  IoCtx ioctx;
+  std::string pool_name = get_temp_pool_name();
+  ASSERT_EQ("", create_one_pool_pp(pool_name, cluster));
+  cluster.ioctx_create(pool_name.c_str(), ioctx);
+  memset(buf, 0xcc, sizeof(buf));
+  bufferlist bl1;
+  bl1.append(buf, sizeof(buf));
+  ASSERT_EQ((int)sizeof(buf), ioctx.write("foo", bl1, sizeof(buf), 0));
+  memset(buf2, 0xdd, sizeof(buf2));
+  bufferlist bl2;
+  bl2.append(buf2, sizeof(buf2));
+  ASSERT_EQ(0, ioctx.write_full("foo", bl2));
+  bufferlist bl3;
+  ASSERT_EQ((int)sizeof(buf2), ioctx.read("foo", bl3, sizeof(buf), 0));
+  ASSERT_EQ(0, memcmp(bl3.c_str(), buf2, sizeof(buf2)));
+  ioctx.close();
+  ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster));
+}
+
 TEST(LibRadosIo, AppendRoundTrip) {
   char buf[64];
   char buf2[64];