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:
parent
536beb1306
commit
84b5a8c1d6
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "spdk/stdinc.h"
|
#include "spdk/stdinc.h"
|
||||||
|
|
||||||
#include "common/lib/test_env.c"
|
#include "common/lib/ut_multithread.c"
|
||||||
#include "spdk_cunit.h"
|
#include "spdk_cunit.h"
|
||||||
#include "spdk_internal/mock.h"
|
#include "spdk_internal/mock.h"
|
||||||
#include "spdk_internal/thread.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,
|
DEFINE_STUB(spdk_bdev_get_block_size, uint32_t,
|
||||||
(const struct spdk_bdev *bdev), 512);
|
(const struct spdk_bdev *bdev), 512);
|
||||||
|
|
||||||
static void
|
|
||||||
_subsystem_send_msg(spdk_msg_fn fn, void *ctx, void *thread_ctx)
|
|
||||||
{
|
|
||||||
fn(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
subsystem_ns_remove_cb(struct spdk_nvmf_subsystem *subsystem, void *cb_arg, int status)
|
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);
|
CU_ASSERT(subsystem.max_nsid == 5);
|
||||||
|
|
||||||
spdk_nvmf_subsystem_remove_ns(&subsystem, 1, subsystem_ns_remove_cb, NULL);
|
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);
|
spdk_nvmf_subsystem_remove_ns(&subsystem, 5, subsystem_ns_remove_cb, NULL);
|
||||||
|
poll_threads();
|
||||||
|
|
||||||
free(subsystem.ns);
|
free(subsystem.ns);
|
||||||
free(tgt.subsystems);
|
free(tgt.subsystems);
|
||||||
@ -449,7 +445,6 @@ test_spdk_nvmf_subsystem_set_sn(void)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct spdk_thread *thread;
|
|
||||||
CU_pSuite suite = NULL;
|
CU_pSuite suite = NULL;
|
||||||
unsigned int num_failures;
|
unsigned int num_failures;
|
||||||
|
|
||||||
@ -471,15 +466,15 @@ int main(int argc, char **argv)
|
|||||||
return CU_get_error();
|
return CU_get_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
thread = spdk_allocate_thread(_subsystem_send_msg, NULL, NULL, NULL, "thread0");
|
allocate_threads(1);
|
||||||
spdk_set_thread(thread);
|
set_thread(0);
|
||||||
|
|
||||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||||
CU_basic_run_tests();
|
CU_basic_run_tests();
|
||||||
num_failures = CU_get_number_of_failures();
|
num_failures = CU_get_number_of_failures();
|
||||||
CU_cleanup_registry();
|
CU_cleanup_registry();
|
||||||
|
|
||||||
spdk_free_thread();
|
free_threads();
|
||||||
|
|
||||||
return num_failures;
|
return num_failures;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user