ut/nvme: add unit test for test_nvme_completion_poll_cb()

Change-Id: Ib848a58821d17b76195af2074613216c03734392
Signed-off-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/372548
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Paul Luse 2017-08-03 09:59:07 -07:00 committed by Daniel Verkamp
parent b85529572b
commit 56799c8d9b

View File

@ -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",