From: Matan Breizman Date: Wed, 23 Nov 2022 13:20:01 +0000 (+0000) Subject: test/librados/aio_cxx: Fix PoolEIOFlag test X-Git-Tag: v18.1.0~829^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d420acd2491179487734cfa5659b27c6c228cf9e;p=ceph.git test/librados/aio_cxx: Fix PoolEIOFlag test * wait_for_complete is added before getting the return value. * for loop iteration limit is added to avoid infinite run. Signed-off-by: Matan Breizman --- diff --git a/src/test/librados/aio_cxx.cc b/src/test/librados/aio_cxx.cc index 31914ff1b56ea..1f3d6c4b85b73 100644 --- a/src/test/librados/aio_cxx.cc +++ b/src/test/librados/aio_cxx.cc @@ -2267,6 +2267,10 @@ void pool_io_callback(completion_t cb, void *arg /* Actually AioCompletion* */) { io_info *info = (io_info *)arg; unsigned long i = info->i; + { + TestAlarm alarm; + ASSERT_EQ(0, info->c->wait_for_complete()); + } int r = info->c->get_return_value(); //cout << "finish " << i << " r = " << r << std::endl; @@ -2294,7 +2298,7 @@ TEST(LibRadosAio, PoolEIOFlag) { unsigned max = 100; unsigned long i = 1; my_lock.lock(); - for (; min_failed == 0; ++i) { + for (; min_failed == 0 && i <= max; ++i) { io_info *info = new io_info; info->i = i; info->c = Rados::aio_create_completion(); @@ -2309,14 +2313,13 @@ TEST(LibRadosAio, PoolEIOFlag) { t = new std::thread( [&] { bufferlist empty; - int r = test_data.m_cluster.mon_command( + ASSERT_EQ(0, test_data.m_cluster.mon_command( "{\"prefix\": \"osd pool set\", \"pool\": \"" + test_data.m_pool_name + - "\", \"var\": \"eio\", \"val\": \"true\"}", empty, nullptr, nullptr); - ceph_assert(r == 0); + "\", \"var\": \"eio\", \"val\": \"true\"}", empty, nullptr, nullptr)); }); } - std::this_thread::sleep_for(10'000us); + std::this_thread::sleep_for(10ms); my_lock.lock(); if (r < 0) { inflight.erase(i);