]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add librados global op flags test
authorJosh Durgin <jdurgin@redhat.com>
Mon, 30 Mar 2015 21:33:19 +0000 (14:33 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 30 Mar 2015 22:19:25 +0000 (15:19 -0700)
Just verify that the read gets the right data, to demonstrate that
passing a flag doesn't cause problems.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/test/librados/c_read_operations.cc

index 9b577471bab7d01fd400c1bb70981a2399d562f6..d80fcdfa2eac0eff5e0cdb92e5741b8b3c52f41c 100644 (file)
@@ -312,6 +312,26 @@ TEST_F(CReadOpsTest, Read) {
   remove_object();
 }
 
+
+TEST_F(CReadOpsTest, RWOrderedRead) {
+  write_object();
+
+  char buf[len];
+  rados_read_op_t op = rados_create_read_op();
+  size_t bytes_read = 0;
+  int rval;
+  rados_read_op_read(op, 0, len, buf, &bytes_read, &rval);
+  rados_read_op_set_flags(op, LIBRADOS_OP_FLAG_FADVISE_DONTNEED);
+  ASSERT_EQ(0, rados_read_op_operate(op, ioctx, obj,
+                                    LIBRADOS_OPERATION_ORDER_READS_WRITES));
+  ASSERT_EQ(len, (int)bytes_read);
+  ASSERT_EQ(0, rval);
+  ASSERT_EQ(0, memcmp(data, buf, len));
+  rados_release_read_op(op);
+
+  remove_object();
+}
+
 TEST_F(CReadOpsTest, ShortRead) {
   write_object();