unit/nvme: add FC and TCP in trid trtype test case.

Add two trtype test and increase code coverage.

Change-Id: I59543dc6aa56529b05bb7ac5717d9ba7004b8b72
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453626
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
JinYu 2019-05-08 22:26:54 +08:00 committed by Jim Harris
parent 62966da34c
commit 743081c22b

View File

@ -956,6 +956,23 @@ test_spdk_nvme_transport_id_parse_trtype(void)
spdk_nvme_transport_id_parse_trtype(trtype, str);
CU_ASSERT((*trtype) == SPDK_NVME_TRANSPORT_RDMA);
/* test trtype value when use function "strcasecmp" to compare str and "FC"not case-sensitive */
str = "FC";
spdk_nvme_transport_id_parse_trtype(trtype, str);
CU_ASSERT((*trtype) == SPDK_NVME_TRANSPORT_FC);
str = "fc";
spdk_nvme_transport_id_parse_trtype(trtype, str);
CU_ASSERT((*trtype) == SPDK_NVME_TRANSPORT_FC);
/* test trtype value when use function "strcasecmp" to compare str and "TCP"not case-sensitive */
str = "TCP";
spdk_nvme_transport_id_parse_trtype(trtype, str);
CU_ASSERT((*trtype) == SPDK_NVME_TRANSPORT_TCP);
str = "tcp";
spdk_nvme_transport_id_parse_trtype(trtype, str);
CU_ASSERT((*trtype) == SPDK_NVME_TRANSPORT_TCP);
}
static void
@ -1035,6 +1052,14 @@ test_trid_trtype_str(void)
s = spdk_nvme_transport_id_trtype_str(SPDK_NVME_TRANSPORT_RDMA);
SPDK_CU_ASSERT_FATAL(s != NULL);
CU_ASSERT(strcmp(s, "RDMA") == 0);
s = spdk_nvme_transport_id_trtype_str(SPDK_NVME_TRANSPORT_FC);
SPDK_CU_ASSERT_FATAL(s != NULL);
CU_ASSERT(strcmp(s, "FC") == 0);
s = spdk_nvme_transport_id_trtype_str(SPDK_NVME_TRANSPORT_TCP);
SPDK_CU_ASSERT_FATAL(s != NULL);
CU_ASSERT(strcmp(s, "TCP") == 0);
}
static void