test: Use ut_multithread framework in nvmf subsystem unit test

Use the default thread implementation instead.

Change-Id: I844b02ba3c45d323e9f16b328a31b9d38dc8f754
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/422466
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Ben Walker 2018-08-15 13:56:46 -07:00 committed by Jim Harris
parent 536beb1306
commit 84b5a8c1d6

View File

@ -33,7 +33,7 @@
#include "spdk/stdinc.h"
#include "common/lib/test_env.c"
#include "common/lib/ut_multithread.c"
#include "spdk_cunit.h"
#include "spdk_internal/mock.h"
#include "spdk_internal/thread.h"
@ -53,12 +53,6 @@ DEFINE_STUB_V(spdk_bdev_module_release_bdev,
DEFINE_STUB(spdk_bdev_get_block_size, uint32_t,
(const struct spdk_bdev *bdev), 512);
static void
_subsystem_send_msg(spdk_msg_fn fn, void *ctx, void *thread_ctx)
{
fn(ctx);
}
static void
subsystem_ns_remove_cb(struct spdk_nvmf_subsystem *subsystem, void *cb_arg, int status)
{
@ -295,7 +289,9 @@ test_spdk_nvmf_subsystem_add_ns(void)
CU_ASSERT(subsystem.max_nsid == 5);
spdk_nvmf_subsystem_remove_ns(&subsystem, 1, subsystem_ns_remove_cb, NULL);
poll_threads();
spdk_nvmf_subsystem_remove_ns(&subsystem, 5, subsystem_ns_remove_cb, NULL);
poll_threads();
free(subsystem.ns);
free(tgt.subsystems);
@ -449,7 +445,6 @@ test_spdk_nvmf_subsystem_set_sn(void)
int main(int argc, char **argv)
{
struct spdk_thread *thread;
CU_pSuite suite = NULL;
unsigned int num_failures;
@ -471,15 +466,15 @@ int main(int argc, char **argv)
return CU_get_error();
}
thread = spdk_allocate_thread(_subsystem_send_msg, NULL, NULL, NULL, "thread0");
spdk_set_thread(thread);
allocate_threads(1);
set_thread(0);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
num_failures = CU_get_number_of_failures();
CU_cleanup_registry();
spdk_free_thread();
free_threads();
return num_failures;
}