test: Use ut_multithread framework in bdev/pmem
Change-Id: Ib9de83db429e4ae6f8e0cc988ca161cebdb27c9c Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/437599 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
1abf660320
commit
9bef42f284
@ -120,8 +120,8 @@ poll_thread(uintptr_t thread_id)
|
||||
struct ut_thread *thread = &g_ut_threads[thread_id];
|
||||
uintptr_t original_thread_id;
|
||||
|
||||
CU_ASSERT(thread_id != (uintptr_t)INVALID_THREAD);
|
||||
CU_ASSERT(thread_id < g_ut_num_threads);
|
||||
assert(thread_id != (uintptr_t)INVALID_THREAD);
|
||||
assert(thread_id < g_ut_num_threads);
|
||||
|
||||
original_thread_id = g_thread_id;
|
||||
set_thread(INVALID_THREAD);
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "spdk_cunit.h"
|
||||
|
||||
#include "common/lib/test_env.c"
|
||||
#include "common/lib/ut_multithread.c"
|
||||
#include "unit/lib/json_mock.c"
|
||||
|
||||
#include "spdk_internal/thread.h"
|
||||
@ -100,12 +100,6 @@ static struct spdk_bdev *g_bdev;
|
||||
static const char *g_check_version_msg;
|
||||
static bool g_pmemblk_open_allow_open = true;
|
||||
|
||||
static void
|
||||
_pmem_send_msg(spdk_msg_fn fn, void *ctx, void *thread_ctx)
|
||||
{
|
||||
fn(ctx);
|
||||
}
|
||||
|
||||
static PMEMblkpool *
|
||||
find_pmemblk_pool(const char *path)
|
||||
{
|
||||
@ -370,8 +364,9 @@ ut_pmem_blk_clean(void)
|
||||
|
||||
/* Unload module to free IO channel */
|
||||
g_bdev_pmem_module->module_fini();
|
||||
poll_threads();
|
||||
|
||||
spdk_free_thread();
|
||||
free_threads();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -379,12 +374,10 @@ ut_pmem_blk_clean(void)
|
||||
static int
|
||||
ut_pmem_blk_init(void)
|
||||
{
|
||||
struct spdk_thread *thread;
|
||||
|
||||
errno = 0;
|
||||
|
||||
thread = spdk_allocate_thread(_pmem_send_msg, NULL, NULL, NULL, NULL);
|
||||
spdk_set_thread(thread);
|
||||
allocate_threads(1);
|
||||
set_thread(0);
|
||||
|
||||
g_pool_ok.buffer = calloc(g_pool_ok.nblock, g_pool_ok.bsize);
|
||||
if (g_pool_ok.buffer == NULL) {
|
||||
@ -784,5 +777,6 @@ main(int argc, char **argv)
|
||||
CU_basic_run_tests();
|
||||
num_failures = CU_get_number_of_failures();
|
||||
CU_cleanup_registry();
|
||||
|
||||
return num_failures;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user