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

index d86a3a750b87bf96c3a55af381332327ff3b31e8..6b73e6f5d94b729015a1b8df498190ba5cdf4969 100644 (file)
@@ -1,9 +1,12 @@
 #include "include/rados/librados.h"
+#include "include/rados/librados.hpp"
 #include "test/rados-api/test.h"
 
 #include <errno.h>
 #include "gtest/gtest.h"
 
+using namespace librados;
+
 TEST(LibRadosIo, SimpleWrite) {
   char buf[128];
   rados_t cluster;
@@ -17,6 +20,21 @@ TEST(LibRadosIo, SimpleWrite) {
   ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster));
 }
 
+TEST(LibRadosIo, SimpleWritePP) {
+  char buf[128];
+  std::string pool_name = get_temp_pool_name();
+  Rados cluster;
+  ASSERT_EQ("", create_one_pool_pp(pool_name, cluster));
+  IoCtx ioctx;
+  cluster.ioctx_create(pool_name.c_str(), ioctx);
+  memset(buf, 0xcc, sizeof(buf));
+  bufferlist bl;
+  bl.append(buf, sizeof(buf));
+  ASSERT_EQ((int)sizeof(buf), ioctx.write("foo", bl, sizeof(buf), 0));
+  ioctx.close();
+  ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster));
+}
+
 TEST(LibRadosIo, RoundTrip) {
   char buf[128];
   char buf2[128];