]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: erasure coded pools do not allow offset on creation 4508/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 30 Apr 2015 00:06:20 +0000 (02:06 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 5 May 2015 12:42:08 +0000 (14:42 +0200)
If a write operation implicitly creates an object on an erasure coded
pool, there cannot be an offset > 0, even if it is properly aligned.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/librados/io.cc

index 6f391df7353bd7b751de7b1a7eb294535066ad07..d01f09023b9010fb2472bed3bfd2c72085b49f68 100644 (file)
@@ -231,6 +231,13 @@ TEST_F(LibRadosIo, RoundTrip) {
   memset(buf2, 0, sizeof(buf2));
   ASSERT_EQ((int)sizeof(buf2), rados_read(ioctx, "foo", buf2, sizeof(buf2), 0));
   ASSERT_EQ(0, memcmp(buf, buf2, sizeof(buf)));
+
+  uint64_t off = 19;
+  memset(buf, 0xcc, sizeof(buf));
+  ASSERT_EQ(0, rados_write(ioctx, "bar", buf, sizeof(buf), off));
+  memset(buf2, 0, sizeof(buf2));
+  ASSERT_EQ((int)sizeof(buf2), rados_read(ioctx, "bar", buf2, sizeof(buf2), off));
+  ASSERT_EQ(0, memcmp(buf, buf2, sizeof(buf)));
 }
 
 TEST_F(LibRadosIoPP, RoundTripPP) {
@@ -697,6 +704,9 @@ TEST_F(LibRadosIoEC, RoundTrip) {
   memset(buf2, 0, sizeof(buf2));
   ASSERT_EQ((int)sizeof(buf2), rados_read(ioctx, "foo", buf2, sizeof(buf2), 0));
   ASSERT_EQ(0, memcmp(buf, buf2, sizeof(buf)));
+
+  uint64_t off = 19;
+  ASSERT_EQ(-EOPNOTSUPP, rados_write(ioctx, "bar", buf, sizeof(buf), off));
 }
 
 TEST_F(LibRadosIoECPP, RoundTripPP) {