test/nvme : Add test io_cmd_raw_no_payload_build to unittest.
This function has not been tested, add test in nvme_ctrlr_cmd_ut.c to increase code coverage rate. Change-Id: Ibe5c98924d9e2f3239d782e7a32b828caaddb04a Signed-off-by: yidong0635 <dongx.yi@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470718 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
7fa15e28e4
commit
729fa9743f
@ -139,6 +139,15 @@ static void verify_abort_cmd(struct nvme_request *req)
|
||||
CU_ASSERT(req->cmd.cdw10 == (((uint32_t)abort_cid << 16) | abort_sqid));
|
||||
}
|
||||
|
||||
static void verify_io_cmd_raw_no_payload_build(struct nvme_request *req)
|
||||
{
|
||||
struct spdk_nvme_cmd command = {};
|
||||
struct nvme_payload payload = {};
|
||||
|
||||
CU_ASSERT(memcmp(&req->cmd, &command, sizeof(req->cmd)) == 0);
|
||||
CU_ASSERT(memcmp(&req->payload, &payload, sizeof(req->payload)) == 0);
|
||||
}
|
||||
|
||||
static void verify_io_raw_cmd(struct nvme_request *req)
|
||||
{
|
||||
struct spdk_nvme_cmd command = {};
|
||||
@ -502,6 +511,18 @@ test_abort_cmd(void)
|
||||
spdk_nvme_ctrlr_cmd_abort(&ctrlr, &qpair, abort_cid, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_io_cmd_raw_no_payload_build(void)
|
||||
{
|
||||
DECLARE_AND_CONSTRUCT_CTRLR();
|
||||
struct spdk_nvme_qpair qpair = {};
|
||||
struct spdk_nvme_cmd cmd = {};
|
||||
|
||||
verify_fn = verify_io_cmd_raw_no_payload_build;
|
||||
|
||||
spdk_nvme_ctrlr_io_cmd_raw_no_payload_build(&ctrlr, &qpair, &cmd, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_io_raw_cmd(void)
|
||||
{
|
||||
@ -649,6 +670,8 @@ int main(int argc, char **argv)
|
||||
|| CU_add_test(suite, "test ctrlr cmd get_feature", test_get_feature_cmd) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd get_feature_ns", test_get_feature_ns_cmd) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd abort_cmd", test_abort_cmd) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd io_raw_no_payload_build",
|
||||
test_io_cmd_raw_no_payload_build) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd io_raw_cmd", test_io_raw_cmd) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd io_raw_cmd_with_md", test_io_raw_cmd_with_md) == NULL
|
||||
|| CU_add_test(suite, "test ctrlr cmd namespace_attach", test_namespace_attach) == NULL
|
||||
|
Loading…
Reference in New Issue
Block a user