From f6f1161fcda9c68eb4c56aca742873f41b20859b Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 16 Nov 2018 14:49:20 -0700 Subject: [PATCH] test/nvmf: Simplify thread handling in ctrlr_ut Change-Id: Ic804ad99a28b3ba03b67c1733e46f280e0ad9cb8 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/433681 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c b/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c index 20271f945..c49ae2a8e 100644 --- a/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c +++ b/test/unit/lib/nvmf/ctrlr.c/ctrlr_ut.c @@ -258,7 +258,6 @@ static void test_connect(void) { struct spdk_nvmf_fabric_connect_data connect_data; - struct spdk_thread *thread; struct spdk_nvmf_poll_group group; struct spdk_nvmf_transport transport; struct spdk_nvmf_subsystem subsystem; @@ -278,11 +277,8 @@ test_connect(void) const char hostnqn[] = "nqn.2016-06.io.spdk:host1"; int rc; - thread = spdk_allocate_thread(ctrlr_ut_pass_msg, NULL, NULL, NULL, "ctrlr_ut"); - SPDK_CU_ASSERT_FATAL(thread != NULL); - memset(&group, 0, sizeof(group)); - group.thread = thread; + group.thread = spdk_get_thread(); memset(&ctrlr, 0, sizeof(ctrlr)); ctrlr.subsys = &subsystem; @@ -312,7 +308,7 @@ test_connect(void) snprintf(connect_data.hostnqn, sizeof(connect_data.hostnqn), "%s", hostnqn); memset(&subsystem, 0, sizeof(subsystem)); - subsystem.thread = thread; + subsystem.thread = spdk_get_thread(); subsystem.id = 1; TAILQ_INIT(&subsystem.ctrlrs); subsystem.tgt = &tgt; @@ -557,7 +553,6 @@ test_connect(void) MOCK_CLEAR(spdk_nvmf_poll_group_create); spdk_bit_array_free(&ctrlr.qpair_mask); - spdk_free_thread(); } static void @@ -794,9 +789,14 @@ int main(int argc, char **argv) return CU_get_error(); } + spdk_allocate_thread(ctrlr_ut_pass_msg, NULL, NULL, NULL, "ctrlr_ut"); + CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); num_failures = CU_get_number_of_failures(); CU_cleanup_registry(); + + spdk_free_thread(); + return num_failures; }