test/nvme: Add test_doorbell_buffer_config for nvme_ctrlr_cmd.

Add test_doorbell_buffer_config in nvme_ctrlr_cmd_ut.c to increase
code coverage rate.

Change-Id: If79cca086800dfe18fa041de9262a2e32ff1ebc1
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470707
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
yidong0635 2019-10-08 07:04:17 -04:00 committed by Jim Harris
parent 4c13df5116
commit 2dab6e4ab2

View File

@ -54,6 +54,8 @@ uint32_t fw_img_offset = 0;
uint16_t abort_cid = 1;
uint16_t abort_sqid = 1;
uint32_t namespace_management_nsid = 1;
uint64_t PRP_ENTRY_1 = 4096;
uint64_t PRP_ENTRY_2 = 4096;
uint32_t format_nvme_nsid = 1;
uint32_t sanitize_nvme_nsid = 1;
@ -259,6 +261,13 @@ static void verify_namespace_delete(struct nvme_request *req)
CU_ASSERT(req->cmd.nsid == namespace_management_nsid);
}
static void verify_doorbell_buffer_config(struct nvme_request *req)
{
CU_ASSERT(req->cmd.opc == SPDK_NVME_OPC_DOORBELL_BUFFER_CONFIG);
CU_ASSERT(req->cmd.dptr.prp.prp1 == PRP_ENTRY_1);
CU_ASSERT(req->cmd.dptr.prp.prp2 == PRP_ENTRY_2);
}
static void verify_format_nvme(struct nvme_request *req)
{
CU_ASSERT(req->cmd.opc == SPDK_NVME_OPC_FORMAT_NVM);
@ -595,6 +604,16 @@ test_namespace_delete(void)
nvme_ctrlr_cmd_delete_ns(&ctrlr, namespace_management_nsid, NULL, NULL);
}
static void
test_doorbell_buffer_config(void)
{
DECLARE_AND_CONSTRUCT_CTRLR();
verify_fn = verify_doorbell_buffer_config;
nvme_ctrlr_cmd_doorbell_buffer_config(&ctrlr, PRP_ENTRY_1, PRP_ENTRY_2, NULL, NULL);
}
static void
test_format_nvme(void)
{
@ -678,6 +697,7 @@ int main(int argc, char **argv)
|| CU_add_test(suite, "test ctrlr cmd namespace_detach", test_namespace_detach) == NULL
|| CU_add_test(suite, "test ctrlr cmd namespace_create", test_namespace_create) == NULL
|| CU_add_test(suite, "test ctrlr cmd namespace_delete", test_namespace_delete) == NULL
|| CU_add_test(suite, "test ctrlr cmd doorbell_buffer_config", test_doorbell_buffer_config) == NULL
|| CU_add_test(suite, "test ctrlr cmd format_nvme", test_format_nvme) == NULL
|| CU_add_test(suite, "test ctrlr cmd fw_commit", test_fw_commit) == NULL
|| CU_add_test(suite, "test ctrlr cmd fw_image_download", test_fw_image_download) == NULL