thread: Call spdk_thread_lib_init in unit tests
Change-Id: Ib05b9f2ea6582a96b0719a2834c2ad6896fb744e Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453011 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
1c8a1064b0
commit
df9129300c
@ -80,6 +80,8 @@ allocate_threads(int num_threads)
|
|||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
spdk_thread_lib_init(NULL, 0);
|
||||||
|
|
||||||
g_ut_num_threads = num_threads;
|
g_ut_num_threads = num_threads;
|
||||||
|
|
||||||
g_ut_threads = calloc(num_threads, sizeof(*g_ut_threads));
|
g_ut_threads = calloc(num_threads, sizeof(*g_ut_threads));
|
||||||
@ -110,6 +112,8 @@ free_threads(void)
|
|||||||
g_ut_num_threads = 0;
|
g_ut_num_threads = 0;
|
||||||
free(g_ut_threads);
|
free(g_ut_threads);
|
||||||
g_ut_threads = NULL;
|
g_ut_threads = NULL;
|
||||||
|
|
||||||
|
spdk_thread_lib_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -344,6 +344,8 @@ thread_name(void)
|
|||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
spdk_thread_lib_init(NULL, 0);
|
||||||
|
|
||||||
/* Create thread with no name, which automatically generates one */
|
/* Create thread with no name, which automatically generates one */
|
||||||
thread = spdk_thread_create(NULL, NULL);
|
thread = spdk_thread_create(NULL, NULL);
|
||||||
spdk_set_thread(thread);
|
spdk_set_thread(thread);
|
||||||
@ -362,6 +364,8 @@ thread_name(void)
|
|||||||
SPDK_CU_ASSERT_FATAL(name != NULL);
|
SPDK_CU_ASSERT_FATAL(name != NULL);
|
||||||
CU_ASSERT(strcmp(name, "test_thread") == 0);
|
CU_ASSERT(strcmp(name, "test_thread") == 0);
|
||||||
spdk_thread_exit(thread);
|
spdk_thread_exit(thread);
|
||||||
|
|
||||||
|
spdk_thread_lib_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t device1;
|
static uint64_t device1;
|
||||||
|
Loading…
Reference in New Issue
Block a user