nvme: update nvme_ns_cmd_deallocate unit test

The deallocate command's num_ranges have changed to unit16_t.
Update the nvme_ns_cmd_deallocate unit test for the change.

Change-Id: I43b8637bbb953b0e56c39998e1e6682a54304a8f
Signed-off-by: Liang Yan <liangx.yan@intel.com>
This commit is contained in:
Liang Yan 2015-12-29 11:14:35 +08:00 committed by Daniel Verkamp
parent 625fcb9ed3
commit d5cbe304b9

View File

@ -331,7 +331,7 @@ test_nvme_ns_cmd_deallocate(void)
struct nvme_controller ctrlr;
nvme_cb_fn_t cb_fn = NULL;
void *cb_arg = NULL;
uint8_t num_ranges = 1;
uint16_t num_ranges = 1;
void *payload = NULL;
int rc = 0;
@ -346,6 +346,16 @@ test_nvme_ns_cmd_deallocate(void)
free(payload);
nvme_free_request(g_request);
num_ranges = 256;
payload = malloc(num_ranges * sizeof(struct nvme_dsm_range));
nvme_ns_cmd_deallocate(&ns, payload, num_ranges, cb_fn, cb_arg);
CU_ASSERT(g_request->cmd.opc == NVME_OPC_DATASET_MANAGEMENT);
CU_ASSERT(g_request->cmd.nsid == ns.id);
CU_ASSERT(g_request->cmd.cdw10 == num_ranges - 1u);
CU_ASSERT(g_request->cmd.cdw11 == NVME_DSM_ATTR_DEALLOCATE);
free(payload);
nvme_free_request(g_request);
payload = NULL;
num_ranges = 0;
rc = nvme_ns_cmd_deallocate(&ns, payload, num_ranges, cb_fn, cb_arg);