From df9129300c4a5f160d7d2228b28b6939695e1f9b Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 2 May 2019 12:34:22 -0700 Subject: [PATCH] thread: Call spdk_thread_lib_init in unit tests Change-Id: Ib05b9f2ea6582a96b0719a2834c2ad6896fb744e Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453011 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- test/common/lib/ut_multithread.c | 4 ++++ test/unit/lib/thread/thread.c/thread_ut.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/common/lib/ut_multithread.c b/test/common/lib/ut_multithread.c index 889c0878e..ee7db98be 100644 --- a/test/common/lib/ut_multithread.c +++ b/test/common/lib/ut_multithread.c @@ -80,6 +80,8 @@ allocate_threads(int num_threads) struct spdk_thread *thread; uint32_t i; + spdk_thread_lib_init(NULL, 0); + g_ut_num_threads = num_threads; g_ut_threads = calloc(num_threads, sizeof(*g_ut_threads)); @@ -110,6 +112,8 @@ free_threads(void) g_ut_num_threads = 0; free(g_ut_threads); g_ut_threads = NULL; + + spdk_thread_lib_fini(); } bool diff --git a/test/unit/lib/thread/thread.c/thread_ut.c b/test/unit/lib/thread/thread.c/thread_ut.c index 7b96547cc..bd74be263 100644 --- a/test/unit/lib/thread/thread.c/thread_ut.c +++ b/test/unit/lib/thread/thread.c/thread_ut.c @@ -344,6 +344,8 @@ thread_name(void) struct spdk_thread *thread; const char *name; + spdk_thread_lib_init(NULL, 0); + /* Create thread with no name, which automatically generates one */ thread = spdk_thread_create(NULL, NULL); spdk_set_thread(thread); @@ -362,6 +364,8 @@ thread_name(void) SPDK_CU_ASSERT_FATAL(name != NULL); CU_ASSERT(strcmp(name, "test_thread") == 0); spdk_thread_exit(thread); + + spdk_thread_lib_fini(); } static uint64_t device1;