Commit 56799c8d authored by Paul Luse's avatar Paul Luse Committed by Daniel Verkamp
Browse files

ut/nvme: add unit test for test_nvme_completion_poll_cb()



Change-Id: Ib848a58821d17b76195af2074613216c03734392
Signed-off-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/372548


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent b8552957
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -108,6 +108,21 @@ memset_trid(struct spdk_nvme_transport_id *trid1, struct spdk_nvme_transport_id
	memset(trid2, 0, sizeof(struct spdk_nvme_transport_id));
}

static void
test_nvme_completion_poll_cb(void)
{
	struct nvme_completion_poll_status status;
	struct spdk_nvme_cpl cpl;

	memset(&status, 0x0, sizeof(status));
	memset(&cpl, 0xff, sizeof(cpl));

	nvme_completion_poll_cb(&status, &cpl);
	CU_ASSERT(status.done == true);
	CU_ASSERT(memcmp(&cpl, &status.cpl,
			 sizeof(struct spdk_nvme_cpl)) == 0);
}

/* stub callback used by test_nvme_user_copy_cmd_complete() */
static struct spdk_nvme_cpl ut_spdk_nvme_cpl = {0};
static void
@@ -675,6 +690,8 @@ int main(int argc, char **argv)
			    test_trid_adrfam_str) == NULL ||
		CU_add_test(suite, "test_nvme_ctrlr_probe",
			    test_nvme_ctrlr_probe) == NULL ||
		CU_add_test(suite, "test_nvme_completion_poll_cb",
			    test_nvme_completion_poll_cb) == NULL ||
		CU_add_test(suite, "test_nvme_user_copy_cmd_complete",
			    test_nvme_user_copy_cmd_complete) == NULL ||
		CU_add_test(suite, "test_nvme_allocate_request_null",