thread: Simplify two unit tests with nested poll calls
Now that spdk_thread_poll can be called from within a thread, some of the unit tests can be a bit simpler. Change-Id: Ib7b92c3f59862e5c128f5e0cc8a08f65e2b89e93 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/441160 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
13586cd82d
commit
c1fbefa1bb
@ -779,11 +779,9 @@ blob_snapshot_freeze_io(void)
|
|||||||
* Flag 'frozen_io' is set in _spdk_bs_snapshot_freeze_cpl callback.
|
* Flag 'frozen_io' is set in _spdk_bs_snapshot_freeze_cpl callback.
|
||||||
* Four async I/O operations happen before that. */
|
* Four async I/O operations happen before that. */
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
spdk_thread_poll(thread, 1);
|
spdk_thread_poll(thread, 1);
|
||||||
spdk_thread_poll(thread, 1);
|
spdk_thread_poll(thread, 1);
|
||||||
spdk_thread_poll(thread, 1);
|
spdk_thread_poll(thread, 1);
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
CU_ASSERT(TAILQ_EMPTY(&bs_channel->queued_io));
|
CU_ASSERT(TAILQ_EMPTY(&bs_channel->queued_io));
|
||||||
|
|
||||||
|
@ -146,9 +146,7 @@ _fs_init(void *arg)
|
|||||||
dev = init_dev();
|
dev = init_dev();
|
||||||
spdk_fs_init(dev, NULL, send_request, fs_op_with_handle_complete, NULL);
|
spdk_fs_init(dev, NULL, send_request, fs_op_with_handle_complete, NULL);
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
SPDK_CU_ASSERT_FATAL(g_fs != NULL);
|
SPDK_CU_ASSERT_FATAL(g_fs != NULL);
|
||||||
SPDK_CU_ASSERT_FATAL(g_fs->bdev == dev);
|
SPDK_CU_ASSERT_FATAL(g_fs->bdev == dev);
|
||||||
@ -163,9 +161,7 @@ _fs_unload(void *arg)
|
|||||||
g_fserrno = -1;
|
g_fserrno = -1;
|
||||||
spdk_fs_unload(g_fs, fs_op_complete, NULL);
|
spdk_fs_unload(g_fs, fs_op_complete, NULL);
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
CU_ASSERT(g_fserrno == 0);
|
CU_ASSERT(g_fserrno == 0);
|
||||||
g_fs = NULL;
|
g_fs = NULL;
|
||||||
}
|
}
|
||||||
@ -239,9 +235,7 @@ cache_write_null_buffer(void)
|
|||||||
spdk_fs_free_io_channel(channel);
|
spdk_fs_free_io_channel(channel);
|
||||||
|
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
ut_send_request(_fs_unload, NULL);
|
ut_send_request(_fs_unload, NULL);
|
||||||
}
|
}
|
||||||
@ -271,9 +265,7 @@ fs_create_sync(void)
|
|||||||
spdk_fs_free_io_channel(channel);
|
spdk_fs_free_io_channel(channel);
|
||||||
|
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
ut_send_request(_fs_unload, NULL);
|
ut_send_request(_fs_unload, NULL);
|
||||||
}
|
}
|
||||||
@ -314,9 +306,7 @@ cache_append_no_cache(void)
|
|||||||
spdk_fs_free_io_channel(channel);
|
spdk_fs_free_io_channel(channel);
|
||||||
|
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
ut_send_request(_fs_unload, NULL);
|
ut_send_request(_fs_unload, NULL);
|
||||||
}
|
}
|
||||||
@ -353,9 +343,7 @@ fs_delete_file_without_close(void)
|
|||||||
spdk_fs_free_io_channel(channel);
|
spdk_fs_free_io_channel(channel);
|
||||||
|
|
||||||
thread = spdk_get_thread();
|
thread = spdk_get_thread();
|
||||||
spdk_set_thread(NULL);
|
|
||||||
while (spdk_thread_poll(thread, 0) > 0) {}
|
while (spdk_thread_poll(thread, 0) > 0) {}
|
||||||
spdk_set_thread(thread);
|
|
||||||
|
|
||||||
ut_send_request(_fs_unload, NULL);
|
ut_send_request(_fs_unload, NULL);
|
||||||
|
|
||||||
@ -390,9 +378,7 @@ spdk_thread(void *arg)
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g_mutex);
|
pthread_mutex_unlock(&g_mutex);
|
||||||
|
|
||||||
spdk_set_thread(NULL);
|
|
||||||
spdk_thread_poll(thread, 0);
|
spdk_thread_poll(thread, 0);
|
||||||
spdk_set_thread(thread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user