From 948b15eb52fd5d9ce842fa12ee0cecda17353b01 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 8 Apr 2015 21:55:36 -0400 Subject: [PATCH] tests: update librbd AIO tests to remove result code Signed-off-by: Jason Dillaman --- src/test/librbd/test_ImageWatcher.cc | 30 ++++++++++++++-------------- src/test/librbd/test_internal.cc | 4 ++-- src/test/librbd/test_librbd.cc | 19 ++++++++++++------ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/test/librbd/test_ImageWatcher.cc b/src/test/librbd/test_ImageWatcher.cc index 496ab58cbd83a..b87ccd400ca02 100644 --- a/src/test/librbd/test_ImageWatcher.cc +++ b/src/test/librbd/test_ImageWatcher.cc @@ -171,13 +171,13 @@ public: if (!ictx->image_watcher->is_lock_owner() && (m_expected_aio_restarts == 0 || m_aio_completion_restarts < m_expected_aio_restarts)) { - EXPECT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - aio_completion)); + aio_completion); } else { { Mutex::Locker l2(aio_completion->lock); - aio_completion->complete(); + aio_completion->complete(ictx->cct); } m_aio_completions.erase(aio_completion); @@ -553,12 +553,12 @@ TEST_F(TestImageWatcher, RequestLock) { { RWLock::WLocker l(ictx->owner_lock); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + create_aio_completion(*ictx)); + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); + create_aio_completion(*ictx)); } ASSERT_TRUE(wait_for_notifies(*ictx)); @@ -603,9 +603,9 @@ TEST_F(TestImageWatcher, RequestLockTimedOut) { { RWLock::WLocker l(ictx->owner_lock); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); + create_aio_completion(*ictx)); } ASSERT_TRUE(wait_for_notifies(*ictx)); @@ -630,9 +630,9 @@ TEST_F(TestImageWatcher, RequestLockTryLockRace) { { RWLock::WLocker l(ictx->owner_lock); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); + create_aio_completion(*ictx)); } ASSERT_TRUE(wait_for_notifies(*ictx)); @@ -665,9 +665,9 @@ TEST_F(TestImageWatcher, RequestLockPreTryLockFailed) { { RWLock::WLocker l(ictx->owner_lock); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); + create_aio_completion(*ictx)); } ASSERT_TRUE(wait_for_aio_completions(*ictx)); } @@ -687,9 +687,9 @@ TEST_F(TestImageWatcher, RequestLockPostTryLockFailed) { m_expected_aio_restarts = 1; { RWLock::WLocker l(ictx->owner_lock); - ASSERT_EQ(0, ictx->image_watcher->request_lock( + ictx->image_watcher->request_lock( boost::bind(&TestImageWatcher::handle_restart_aio, this, ictx, _1), - create_aio_completion(*ictx))); + create_aio_completion(*ictx)); } ASSERT_TRUE(wait_for_notifies(*ictx)); diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index 08d6e78a24e2a..181382d833cf9 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -254,7 +254,7 @@ TEST_F(TestInternal, AioWriteRequestsLock) { librbd::AioCompletion *c = librbd::aio_create_completion_internal(ctx, librbd::rbd_ctx_cb); c->get(); - ASSERT_EQ(0, aio_write(ictx, 0, buffer.size(), buffer.c_str(), c, 0)); + aio_write(ictx, 0, buffer.size(), buffer.c_str(), c, 0); bool is_owner; ASSERT_EQ(0, librbd::is_exclusive_lock_owner(ictx, &is_owner)); @@ -277,7 +277,7 @@ TEST_F(TestInternal, AioDiscardRequestsLock) { librbd::AioCompletion *c = librbd::aio_create_completion_internal(ctx, librbd::rbd_ctx_cb); c->get(); - ASSERT_EQ(0, aio_discard(ictx, 0, 256, c)); + aio_discard(ictx, 0, 256, c); bool is_owner; ASSERT_EQ(0, librbd::is_exclusive_lock_owner(ictx, &is_owner)); diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index c4238477bd358..b0be34c2f2898 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -840,8 +840,15 @@ TEST_F(TestLibRBD, TestIO) ASSERT_EQ(10, rbd_write(image, info.size - 10, 100, test_data)); rbd_aio_create_completion(NULL, (rbd_callback_t) simple_read_cb, &comp); - ASSERT_EQ(-EINVAL, rbd_aio_write(image, info.size, 1, test_data, comp)); - ASSERT_EQ(-EINVAL, rbd_aio_read(image, info.size, 1, test_data, comp)); + ASSERT_EQ(0, rbd_aio_write(image, info.size, 1, test_data, comp)); + ASSERT_EQ(0, rbd_aio_wait_for_complete(comp)); + ASSERT_EQ(-EINVAL, rbd_aio_get_return_value(comp)); + rbd_aio_release(comp); + + rbd_aio_create_completion(NULL, (rbd_callback_t) simple_read_cb, &comp); + ASSERT_EQ(0, rbd_aio_read(image, info.size, 1, test_data, comp)); + ASSERT_EQ(0, rbd_aio_wait_for_complete(comp)); + ASSERT_EQ(-EINVAL, rbd_aio_get_return_value(comp)); rbd_aio_release(comp); ASSERT_PASSED(validate_object_map, image); @@ -917,16 +924,16 @@ TEST_F(TestLibRBD, TestIOWithIOHint) LIBRADOS_OP_FLAG_FADVISE_DONTNEED)); rbd_aio_create_completion(NULL, (rbd_callback_t) simple_read_cb, &comp); - ASSERT_EQ(-EINVAL, rbd_aio_write(image, info.size, 1, test_data, comp)); - ASSERT_EQ(-EINVAL, rbd_aio_read2(image, info.size, 1, test_data, comp, - LIBRADOS_OP_FLAG_FADVISE_DONTNEED)); + ASSERT_EQ(0, rbd_aio_read2(image, info.size, 1, test_data, comp, + LIBRADOS_OP_FLAG_FADVISE_DONTNEED)); + ASSERT_EQ(0, rbd_aio_wait_for_complete(comp)); + ASSERT_EQ(-EINVAL, rbd_aio_get_return_value(comp)); rbd_aio_release(comp); ASSERT_PASSED(validate_object_map, image); ASSERT_EQ(0, rbd_close(image)); rados_ioctx_destroy(ioctx); - } TEST_F(TestLibRBD, TestEmptyDiscard) -- 2.39.5