]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add test/rados-api/misc.cc
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 11 Aug 2011 00:06:13 +0000 (17:06 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 11 Aug 2011 00:06:13 +0000 (17:06 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/.gitignore
src/Makefile.am
src/test/rados-api/misc.cc [new file with mode: 0644]

index 287d7d3e5fe6fb3c282eedea2732a8676ccaa2df..972045c7423c7b71d5d9dc1fa10436efd19cde6e 100644 (file)
@@ -99,3 +99,4 @@ test_rados_api_pool
 test_rados_api_stat
 test_rados_api_watch_notify
 test_rados_api_snapshots
+test_rados_api_misc
index c184642eabba30f84bdc21261036a9a529fd3966..77697385ce1b61bc0e92fcaa384d6cfcbe739e48 100644 (file)
@@ -611,6 +611,12 @@ test_rados_api_snapshots_LDADD =  librados.la ${UNITTEST_LDADD}
 test_rados_api_snapshots_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
 bin_DEBUGPROGRAMS += test_rados_api_snapshots
 
+test_rados_api_misc_SOURCES = test/rados-api/misc.cc test/rados-api/test.cc
+test_rados_api_misc_LDFLAGS = ${AM_LDFLAGS}
+test_rados_api_misc_LDADD =  librados.la ${UNITTEST_LDADD}
+test_rados_api_misc_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
+bin_DEBUGPROGRAMS += test_rados_api_misc
+
 # shell scripts
 editpaths = sed \
        -e 's|@bindir[@]|$(bindir)|g' \
diff --git a/src/test/rados-api/misc.cc b/src/test/rados-api/misc.cc
new file mode 100644 (file)
index 0000000..ca29889
--- /dev/null
@@ -0,0 +1,52 @@
+#include "include/rados/librados.h"
+#include "test/rados-api/test.h"
+
+#include <errno.h>
+#include "gtest/gtest.h"
+
+TEST(LibRadosMisc, Version) {
+  int major, minor, extra;
+  rados_version(&major, &minor, &extra);
+}
+
+//TEST(LibRadosMisc, Exec) {
+//  char buf[128];
+//  char buf2[sizeof(buf)];
+//  char buf3[sizeof(buf)];
+//  rados_t cluster;
+//  rados_ioctx_t ioctx;
+//  std::string pool_name = get_temp_pool_name();
+//  ASSERT_EQ("", create_one_pool(pool_name, &cluster));
+//  rados_ioctx_create(cluster, pool_name.c_str(), &ioctx);
+//  memset(buf, 0xcc, sizeof(buf));
+//  ASSERT_EQ((int)sizeof(buf), rados_write(ioctx, "foo", buf, sizeof(buf), 0));
+//  strncpy(buf2, "abracadabra", sizeof(buf2));
+//  memset(buf3, 0, sizeof(buf3));
+//  ASSERT_EQ(0, rados_exec(ioctx, "foo", "crypto", "md5",
+//       buf2, strlen(buf2) + 1, buf3, sizeof(buf3)));
+//  ASSERT_EQ(string("06fce6115b1efc638e0cc2026f69ec43"), string(buf3));
+//  rados_ioctx_destroy(ioctx);
+//  ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster));
+//}
+
+//int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cmdbuf, size_t cmdbuflen);
+
+//TEST(LibRadosMisc, CloneRange) {
+//  char buf[128];
+//  rados_t cluster;
+//  rados_ioctx_t ioctx;
+//  std::string pool_name = get_temp_pool_name();
+//  ASSERT_EQ("", create_one_pool(pool_name, &cluster));
+//  rados_ioctx_create(cluster, pool_name.c_str(), &ioctx);
+//  memset(buf, 0xcc, sizeof(buf));
+//  ASSERT_EQ((int)sizeof(buf), rados_write(ioctx, "src", buf, sizeof(buf), 0));
+//  rados_ioctx_locator_set_key(ioctx, "src");
+//  ASSERT_EQ(0, rados_clone_range(ioctx, "dst", 0, "src", 0, sizeof(buf)));
+//  rados_ioctx_locator_set_key(ioctx, NULL);
+//  char buf2[sizeof(buf)];
+//  memset(buf2, 0, sizeof(buf2));
+//  ASSERT_EQ((int)sizeof(buf2), rados_read(ioctx, "dst", buf2, sizeof(buf2), 0));
+//  ASSERT_EQ(0, memcmp(buf, buf2, sizeof(buf)));
+//  rados_ioctx_destroy(ioctx);
+//  ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster));
+//}