test/nvme: Only test non-contiguous namespaces for NVMe 1.2 or higher

This wasn't supported before NVMe 1.2

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ibf19cd77e522eb11c2091a9f4956f5616876986b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2021-11-01 13:14:53 -07:00 committed by Jim Harris
parent 52e432dff2
commit 2dbdb9945c

View File

@ -2118,14 +2118,18 @@ test_nvme_ctrlr_test_active_ns(void)
nsid = spdk_nvme_ctrlr_get_first_active_ns(&ctrlr);
CU_ASSERT(nsid == 1);
ctrlr.active_ns_list[1] = 3;
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 1) == true);
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 2) == false);
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 3) == true);
nsid = spdk_nvme_ctrlr_get_next_active_ns(&ctrlr, nsid);
CU_ASSERT(nsid == 3);
nsid = spdk_nvme_ctrlr_get_next_active_ns(&ctrlr, nsid);
CU_ASSERT(nsid == 0);
if (minor >= 2) {
/* For NVMe 1.2 and newer, the namespace list can have "holes" where
* some namespaces are not active. Test this. */
ctrlr.active_ns_list[1] = 3;
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 1) == true);
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 2) == false);
CU_ASSERT(spdk_nvme_ctrlr_is_active_ns(&ctrlr, 3) == true);
nsid = spdk_nvme_ctrlr_get_next_active_ns(&ctrlr, nsid);
CU_ASSERT(nsid == 3);
nsid = spdk_nvme_ctrlr_get_next_active_ns(&ctrlr, nsid);
CU_ASSERT(nsid == 0);
}
memset(ctrlr.active_ns_list, 0, sizeof(uint32_t) * ctrlr.num_ns);
for (nsid = 0; nsid < ctrlr.num_ns; nsid++) {