Commit 84b5a8c1 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

test: Use ut_multithread framework in nvmf subsystem unit test



Use the default thread implementation instead.

Change-Id: I844b02ba3c45d323e9f16b328a31b9d38dc8f754
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/422466


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 536beb13
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -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;
}