test/nvmf: Use the real io_channel implementation
Previously spdk_thread_send_msg was being defined in the test, but util is also linked in. Instead, use the real io_channel abstraction in the tests. Change-Id: I5c9ce1d0675c43e3ea5b4c88d2dd8282a86a0545 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/414074 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
529d9b0dec
commit
64d75fe2a6
@ -133,6 +133,12 @@ DEFINE_STUB(spdk_nvmf_request_abort,
|
|||||||
(struct spdk_nvmf_request *req),
|
(struct spdk_nvmf_request *req),
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
static void
|
||||||
|
ctrlr_ut_pass_msg(spdk_thread_fn fn, void *ctx, void *thread_ctx)
|
||||||
|
{
|
||||||
|
fn(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_bdev_ctrlr_identify_ns(struct spdk_nvmf_ns *ns, struct spdk_nvme_ns_data *nsdata)
|
spdk_nvmf_bdev_ctrlr_identify_ns(struct spdk_nvmf_ns *ns, struct spdk_nvme_ns_data *nsdata)
|
||||||
{
|
{
|
||||||
@ -240,22 +246,11 @@ nvme_status_success(const struct spdk_nvme_status *status)
|
|||||||
return status->sct == SPDK_NVME_SCT_GENERIC && status->sc == SPDK_NVME_SC_SUCCESS;
|
return status->sct == SPDK_NVME_SCT_GENERIC && status->sc == SPDK_NVME_SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct spdk_thread *
|
|
||||||
spdk_get_thread(void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
spdk_thread_send_msg(const struct spdk_thread *thread, spdk_thread_fn fn, void *ctx)
|
|
||||||
{
|
|
||||||
fn(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_connect(void)
|
test_connect(void)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_fabric_connect_data connect_data;
|
struct spdk_nvmf_fabric_connect_data connect_data;
|
||||||
|
struct spdk_thread *thread;
|
||||||
struct spdk_nvmf_poll_group group;
|
struct spdk_nvmf_poll_group group;
|
||||||
struct spdk_nvmf_transport transport;
|
struct spdk_nvmf_transport transport;
|
||||||
struct spdk_nvmf_subsystem subsystem;
|
struct spdk_nvmf_subsystem subsystem;
|
||||||
@ -275,7 +270,11 @@ test_connect(void)
|
|||||||
const char hostnqn[] = "nqn.2016-06.io.spdk:host1";
|
const char hostnqn[] = "nqn.2016-06.io.spdk:host1";
|
||||||
int rc;
|
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));
|
memset(&group, 0, sizeof(group));
|
||||||
|
group.thread = thread;
|
||||||
|
|
||||||
memset(&ctrlr, 0, sizeof(ctrlr));
|
memset(&ctrlr, 0, sizeof(ctrlr));
|
||||||
TAILQ_INIT(&ctrlr.qpairs);
|
TAILQ_INIT(&ctrlr.qpairs);
|
||||||
@ -308,6 +307,7 @@ test_connect(void)
|
|||||||
snprintf(connect_data.hostnqn, sizeof(connect_data.hostnqn), "%s", hostnqn);
|
snprintf(connect_data.hostnqn, sizeof(connect_data.hostnqn), "%s", hostnqn);
|
||||||
|
|
||||||
memset(&subsystem, 0, sizeof(subsystem));
|
memset(&subsystem, 0, sizeof(subsystem));
|
||||||
|
subsystem.thread = thread;
|
||||||
subsystem.id = 1;
|
subsystem.id = 1;
|
||||||
TAILQ_INIT(&subsystem.ctrlrs);
|
TAILQ_INIT(&subsystem.ctrlrs);
|
||||||
subsystem.tgt = &tgt;
|
subsystem.tgt = &tgt;
|
||||||
@ -555,6 +555,7 @@ test_connect(void)
|
|||||||
MOCK_SET(spdk_nvmf_poll_group_create, struct spdk_nvmf_poll_group *, NULL);
|
MOCK_SET(spdk_nvmf_poll_group_create, struct spdk_nvmf_poll_group *, NULL);
|
||||||
|
|
||||||
spdk_bit_array_free(&ctrlr.qpair_mask);
|
spdk_bit_array_free(&ctrlr.qpair_mask);
|
||||||
|
spdk_free_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user