From: Haomai Wang Date: Mon, 15 Feb 2016 09:33:56 +0000 (+0800) Subject: test: add aio_unwatch unittest X-Git-Tag: v10.1.0~321^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2be574afd0cb6220f4fbbc13c9c3b1c0c98fb401;p=ceph.git test: add aio_unwatch unittest Signed-off-by: Haomai Wang --- diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index da7956afc82f..e63d4ce92ee4 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -257,6 +257,7 @@ TEST_F(LibRadosWatchNotify, AioWatchDelete) { rados_completion_t comp; + uint64_t handle; ASSERT_EQ(0, rados_aio_create_completion(NULL, NULL, NULL, &comp)); rados_aio_watch(ioctx, notify_oid, comp, &handle, watch_notify2_test_cb, watch_notify2_test_errcb, NULL); @@ -273,7 +274,11 @@ TEST_F(LibRadosWatchNotify, AioWatchDelete) { ASSERT_TRUE(left > 0); ASSERT_EQ(-ENOTCONN, notify_err); ASSERT_EQ(-ENOTCONN, rados_watch_check(ioctx, handle)); - rados_unwatch2(ioctx, handle); + ASSERT_EQ(0, rados_aio_create_completion(NULL, NULL, NULL, &comp)); + rados_aio_unwatch(ioctx, handle, comp); + ASSERT_EQ(0, rados_aio_wait_for_complete(comp)); + ASSERT_EQ(-ENOENT, rados_aio_get_return_value(comp)); + rados_aio_release(comp); } TEST_F(LibRadosWatchNotify, Watch2Timeout) { @@ -416,6 +421,7 @@ TEST_F(LibRadosWatchNotify, AioWatchNotify2) { ASSERT_EQ(0, rados_write(ioctx, notify_oid, buf, sizeof(buf), 0)); rados_completion_t comp; + uint64_t handle; ASSERT_EQ(0, rados_aio_create_completion(NULL, NULL, NULL, &comp)); rados_aio_watch(ioctx, notify_oid, comp, &handle, watch_notify2_test_cb, watch_notify2_test_errcb, NULL); @@ -453,7 +459,11 @@ TEST_F(LibRadosWatchNotify, AioWatchNotify2) { ASSERT_EQ((char*)0, reply_buf); ASSERT_EQ(0u, reply_buf_len); - rados_unwatch2(ioctx, handle); + ASSERT_EQ(0, rados_aio_create_completion(NULL, NULL, NULL, &comp)); + rados_aio_unwatch(ioctx, handle, comp); + ASSERT_EQ(0, rados_aio_wait_for_complete(comp)); + ASSERT_EQ(0, rados_aio_get_return_value(comp)); + rados_aio_release(comp); } TEST_F(LibRadosWatchNotify, AioNotify) { @@ -579,6 +589,11 @@ TEST_P(LibRadosWatchNotifyPP, AioWatchNotify2) { ASSERT_EQ(0u, missed_map.size()); ASSERT_GT(ioctx.watch_check(handle), 0); ioctx.unwatch2(handle); + + comp = cluster.aio_create_completion(); + ioctx.aio_unwatch(handle, comp); + ASSERT_EQ(0, comp->wait_for_complete()); + comp->release(); }