From: Xiubo Li Date: Fri, 27 Oct 2023 11:29:04 +0000 (+0800) Subject: ceph_test_rados_api_io_pp: add multiple extents test for sparse-read X-Git-Tag: testing/wip-batrick-testing-20240411.154038~94^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3afae90cd3ecdbf7489d1589e572460966e87c48;p=ceph-ci.git ceph_test_rados_api_io_pp: add multiple extents test for sparse-read Just test more with a larger size to test the sparse-read to find some corner case bugs. Signed-off-by: Xiubo Li --- diff --git a/src/test/librados/io_cxx.cc b/src/test/librados/io_cxx.cc index d9606d16bca..f2051811101 100644 --- a/src/test/librados/io_cxx.cc +++ b/src/test/librados/io_cxx.cc @@ -218,6 +218,39 @@ TEST_F(LibRadosIoPP, SparseReadOpPP) { } } +TEST_F(LibRadosIoPP, SparseReadExtentArrayOpPP) { + int buf_len = 32; + char buf[buf_len], zbuf[buf_len]; + memset(buf, 0xcc, buf_len); + memset(zbuf, 0, buf_len); + bufferlist bl; + int i, len = 1024, skip = 5; + bl.append(buf, buf_len); + for (i = 0; i < len; i++) { + if (!(i % skip) || i == (len - 1)) { + ASSERT_EQ(0, ioctx.write("sparse-read", bl, bl.length(), i * buf_len)); + } + } + + bufferlist expect_bl; + for (i = 0; i < len; i++) { + if (!(i % skip) || i == (len - 1)) { + expect_bl.append(buf, buf_len); + } else { + expect_bl.append(zbuf, buf_len); + } + } + + std::map extents; + bufferlist read_bl; + int rval = -1; + ObjectReadOperation op; + op.sparse_read(0, len * buf_len, &extents, &read_bl, &rval); + ASSERT_EQ(0, ioctx.operate("sparse-read", &op, nullptr)); + ASSERT_EQ(0, rval); + assert_eq_sparse(expect_bl, extents, read_bl); +} + TEST_F(LibRadosIoPP, RoundTripPP) { char buf[128]; Rados cluster;