summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:05:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:05:25 +0000
commitd3b6c0269abf2332f6f4b43760524b040ca58ff8 (patch)
tree6a0ebdb4cb3c7b76c824f021d9f3624d16037457 /test
parentAdding upstream version 1.8. (diff)
downloadlibnvme-84fdb259c83644d2d459fe7d2150c11aeabe771c.tar.xz
libnvme-84fdb259c83644d2d459fe7d2150c11aeabe771c.zip
Adding upstream version 1.9.upstream/1.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rw-r--r--test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery312
-rw-r--r--test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single4
-rw-r--r--test/nbft/diffs/NBFT-Dell.PowerEdge.R7604
-rw-r--r--test/nbft/diffs/NBFT-auto-ipv62
-rw-r--r--test/nbft/diffs/NBFT-dhcp-ipv42
-rw-r--r--test/nbft/diffs/NBFT-dhcp-ipv62
-rw-r--r--test/nbft/diffs/NBFT-mpath+disc-ipv4+6_half141
-rw-r--r--test/nbft/diffs/NBFT-rhpoc2
-rw-r--r--test/nbft/diffs/NBFT-static-ipv42
-rw-r--r--test/nbft/diffs/NBFT-static-ipv4-discovery2
-rw-r--r--test/nbft/diffs/NBFT-static-ipv62
-rw-r--r--test/nbft/meson.build4
-rw-r--r--test/nbft/nbft-dump.c2
-rw-r--r--test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discoverybin0 -> 4147 bytes
-rw-r--r--test/nbft/tables/NBFT-mpath+disc-ipv4+6_halfbin0 -> 1922 bytes
-rw-r--r--test/register.c8
-rw-r--r--test/sysfs/meson.build45
-rwxr-xr-xtest/sysfs/setup.sh11
-rw-r--r--test/sysfs/sysfs-tree-diff.sh22
-rw-r--r--test/sysfs/sysfs.c77
-rw-r--r--test/test-util.c58
21 files changed, 598 insertions, 104 deletions
diff --git a/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery b/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery
new file mode 100644
index 0000000..7d44d92
--- /dev/null
+++ b/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery
@@ -0,0 +1,312 @@
+raw_nbft_size=4147
+host.id=44454c4c44010448030b8c04f445833
+host.nqn=nqn.2014-08.org.nvmexpress:uuid:4c4c4544-0044-4410-8030-b8c04f445833
+host.host_id_configured=1
+host.host_nqn_configured=1
+host.primary=0
+hfi_list[0]->index=1
+hfi_list[0]->transport=tcp
+hfi_list[0]->tcp_info.pci_sbdf=27136
+hfi_list[0]->tcp_info.mac_addr=062bcbeb70
+hfi_list[0]->tcp_info.vlan=0
+hfi_list[0]->tcp_info.ip_origin=95
+hfi_list[0]->tcp_info.ipaddr=172.18.240.1
+hfi_list[0]->tcp_info.subnet_mask_prefix=24
+hfi_list[0]->tcp_info.gateway_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.route_metric=500
+hfi_list[0]->tcp_info.primary_dns_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.secondary_dns_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.dhcp_server_ipaddr=
+hfi_list[0]->tcp_info.host_name=(null)
+hfi_list[0]->tcp_info.this_hfi_is_default_route=1
+hfi_list[0]->tcp_info.dhcp_override=0
+hfi_list[1]->index=2
+hfi_list[1]->transport=tcp
+hfi_list[1]->tcp_info.pci_sbdf=27137
+hfi_list[1]->tcp_info.mac_addr=062bcbeb71
+hfi_list[1]->tcp_info.vlan=0
+hfi_list[1]->tcp_info.ip_origin=95
+hfi_list[1]->tcp_info.ipaddr=172.18.230.2
+hfi_list[1]->tcp_info.subnet_mask_prefix=24
+hfi_list[1]->tcp_info.gateway_ipaddr=0.0.0.0
+hfi_list[1]->tcp_info.route_metric=500
+hfi_list[1]->tcp_info.primary_dns_ipaddr=0.0.0.0
+hfi_list[1]->tcp_info.secondary_dns_ipaddr=0.0.0.0
+hfi_list[1]->tcp_info.dhcp_server_ipaddr=
+hfi_list[1]->tcp_info.host_name=(null)
+hfi_list[1]->tcp_info.this_hfi_is_default_route=1
+hfi_list[1]->tcp_info.dhcp_override=0
+discovery_list[0]->index=1
+discovery_list[0]->hfi->index=1
+discovery_list[0]->uri=nvme+tcp://172.18.240.70:8009/
+discovery_list[0]->nqn=nqn.2014-08.org.nvmexpress.discovery
+discovery_list[1]->index=2
+discovery_list[1]->hfi->index=2
+discovery_list[1]->uri=nvme+tcp://172.18.230.70:8009/
+discovery_list[1]->nqn=nqn.2014-08.org.nvmexpress.discovery
+subsystem_ns_list[0]->index=1
+subsystem_ns_list[0]->discovery->index=1
+subsystem_ns_list[0]->num_hfis=1
+subsystem_ns_list[0]->hfis[0]->index=1
+subsystem_ns_list[0]->transport=tcp
+subsystem_ns_list[0]->traddr=172.18.240.60
+subsystem_ns_list[0]->trsvcid=4420
+subsystem_ns_list[0]->subsys_port_id=0
+subsystem_ns_list[0]->nsid=270
+subsystem_ns_list[0]->nid_type=2
+subsystem_ns_list[0]->nid=5380b42fc0c5de718ccf9680be3ca7
+subsystem_ns_list[0]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[0]->pdu_header_digest_required=0
+subsystem_ns_list[0]->data_digest_required=0
+subsystem_ns_list[0]->controller_id=4186
+subsystem_ns_list[0]->asqsz=0
+subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=1
+subsystem_ns_list[0]->unavailable=0
+subsystem_ns_list[1]->index=2
+subsystem_ns_list[1]->discovery->index=1
+subsystem_ns_list[1]->num_hfis=1
+subsystem_ns_list[1]->hfis[0]->index=1
+subsystem_ns_list[1]->transport=tcp
+subsystem_ns_list[1]->traddr=172.18.240.60
+subsystem_ns_list[1]->trsvcid=4420
+subsystem_ns_list[1]->subsys_port_id=0
+subsystem_ns_list[1]->nsid=1671
+subsystem_ns_list[1]->nid_type=2
+subsystem_ns_list[1]->nid=f4c66fce74afdb8ccf96807eaeae
+subsystem_ns_list[1]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[1]->pdu_header_digest_required=0
+subsystem_ns_list[1]->data_digest_required=0
+subsystem_ns_list[1]->controller_id=4186
+subsystem_ns_list[1]->asqsz=0
+subsystem_ns_list[1]->dhcp_root_path_string=(null)
+subsystem_ns_list[1]->discovered=1
+subsystem_ns_list[1]->unavailable=0
+subsystem_ns_list[2]->index=3
+subsystem_ns_list[2]->discovery->index=1
+subsystem_ns_list[2]->num_hfis=1
+subsystem_ns_list[2]->hfis[0]->index=1
+subsystem_ns_list[2]->transport=tcp
+subsystem_ns_list[2]->traddr=172.18.240.61
+subsystem_ns_list[2]->trsvcid=4420
+subsystem_ns_list[2]->subsys_port_id=0
+subsystem_ns_list[2]->nsid=270
+subsystem_ns_list[2]->nid_type=2
+subsystem_ns_list[2]->nid=5380b42fc0c5de718ccf9680be3ca7
+subsystem_ns_list[2]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[2]->pdu_header_digest_required=0
+subsystem_ns_list[2]->data_digest_required=0
+subsystem_ns_list[2]->controller_id=52
+subsystem_ns_list[2]->asqsz=0
+subsystem_ns_list[2]->dhcp_root_path_string=(null)
+subsystem_ns_list[2]->discovered=1
+subsystem_ns_list[2]->unavailable=0
+subsystem_ns_list[3]->index=4
+subsystem_ns_list[3]->discovery->index=1
+subsystem_ns_list[3]->num_hfis=1
+subsystem_ns_list[3]->hfis[0]->index=1
+subsystem_ns_list[3]->transport=tcp
+subsystem_ns_list[3]->traddr=172.18.240.61
+subsystem_ns_list[3]->trsvcid=4420
+subsystem_ns_list[3]->subsys_port_id=0
+subsystem_ns_list[3]->nsid=1671
+subsystem_ns_list[3]->nid_type=2
+subsystem_ns_list[3]->nid=f4c66fce74afdb8ccf96807eaeae
+subsystem_ns_list[3]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[3]->pdu_header_digest_required=0
+subsystem_ns_list[3]->data_digest_required=0
+subsystem_ns_list[3]->controller_id=52
+subsystem_ns_list[3]->asqsz=0
+subsystem_ns_list[3]->dhcp_root_path_string=(null)
+subsystem_ns_list[3]->discovered=1
+subsystem_ns_list[3]->unavailable=0
+subsystem_ns_list[4]->index=5
+subsystem_ns_list[4]->discovery->index=1
+subsystem_ns_list[4]->num_hfis=1
+subsystem_ns_list[4]->hfis[0]->index=1
+subsystem_ns_list[4]->transport=tcp
+subsystem_ns_list[4]->traddr=172.18.240.51
+subsystem_ns_list[4]->trsvcid=4420
+subsystem_ns_list[4]->subsys_port_id=0
+subsystem_ns_list[4]->nsid=1
+subsystem_ns_list[4]->nid_type=3
+subsystem_ns_list[4]->nid=6be5e52f7fa24d57805b8cdce240e4c
+subsystem_ns_list[4]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[4]->pdu_header_digest_required=0
+subsystem_ns_list[4]->data_digest_required=0
+subsystem_ns_list[4]->controller_id=6209
+subsystem_ns_list[4]->asqsz=0
+subsystem_ns_list[4]->dhcp_root_path_string=(null)
+subsystem_ns_list[4]->discovered=1
+subsystem_ns_list[4]->unavailable=0
+subsystem_ns_list[5]->index=6
+subsystem_ns_list[5]->discovery->index=1
+subsystem_ns_list[5]->num_hfis=1
+subsystem_ns_list[5]->hfis[0]->index=1
+subsystem_ns_list[5]->transport=tcp
+subsystem_ns_list[5]->traddr=172.18.240.50
+subsystem_ns_list[5]->trsvcid=4420
+subsystem_ns_list[5]->subsys_port_id=0
+subsystem_ns_list[5]->nsid=1
+subsystem_ns_list[5]->nid_type=3
+subsystem_ns_list[5]->nid=6be5e52f7fa24d57805b8cdce240e4c
+subsystem_ns_list[5]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[5]->pdu_header_digest_required=0
+subsystem_ns_list[5]->data_digest_required=0
+subsystem_ns_list[5]->controller_id=6208
+subsystem_ns_list[5]->asqsz=0
+subsystem_ns_list[5]->dhcp_root_path_string=(null)
+subsystem_ns_list[5]->discovered=1
+subsystem_ns_list[5]->unavailable=0
+subsystem_ns_list[6]->index=7
+subsystem_ns_list[6]->discovery->index=1
+subsystem_ns_list[6]->num_hfis=1
+subsystem_ns_list[6]->hfis[0]->index=1
+subsystem_ns_list[6]->transport=tcp
+subsystem_ns_list[6]->traddr=172.18.230.51
+subsystem_ns_list[6]->trsvcid=4420
+subsystem_ns_list[6]->subsys_port_id=0
+subsystem_ns_list[6]->nsid=0
+subsystem_ns_list[6]->nid_type=0
+subsystem_ns_list[6]->nid=0000000000000000
+subsystem_ns_list[6]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[6]->pdu_header_digest_required=0
+subsystem_ns_list[6]->data_digest_required=0
+subsystem_ns_list[6]->controller_id=6208
+subsystem_ns_list[6]->asqsz=0
+subsystem_ns_list[6]->dhcp_root_path_string=(null)
+subsystem_ns_list[6]->discovered=1
+subsystem_ns_list[6]->unavailable=1
+subsystem_ns_list[7]->index=8
+subsystem_ns_list[7]->discovery->index=1
+subsystem_ns_list[7]->num_hfis=1
+subsystem_ns_list[7]->hfis[0]->index=1
+subsystem_ns_list[7]->transport=tcp
+subsystem_ns_list[7]->traddr=172.18.230.50
+subsystem_ns_list[7]->trsvcid=4420
+subsystem_ns_list[7]->subsys_port_id=0
+subsystem_ns_list[7]->nsid=0
+subsystem_ns_list[7]->nid_type=0
+subsystem_ns_list[7]->nid=0000000000000000
+subsystem_ns_list[7]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[7]->pdu_header_digest_required=0
+subsystem_ns_list[7]->data_digest_required=0
+subsystem_ns_list[7]->controller_id=6208
+subsystem_ns_list[7]->asqsz=0
+subsystem_ns_list[7]->dhcp_root_path_string=(null)
+subsystem_ns_list[7]->discovered=1
+subsystem_ns_list[7]->unavailable=1
+subsystem_ns_list[8]->index=9
+subsystem_ns_list[8]->discovery->index=2
+subsystem_ns_list[8]->num_hfis=1
+subsystem_ns_list[8]->hfis[0]->index=2
+subsystem_ns_list[8]->transport=tcp
+subsystem_ns_list[8]->traddr=172.18.230.61
+subsystem_ns_list[8]->trsvcid=4420
+subsystem_ns_list[8]->subsys_port_id=0
+subsystem_ns_list[8]->nsid=270
+subsystem_ns_list[8]->nid_type=2
+subsystem_ns_list[8]->nid=5380b42fc0c5de718ccf9680be3ca7
+subsystem_ns_list[8]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[8]->pdu_header_digest_required=0
+subsystem_ns_list[8]->data_digest_required=0
+subsystem_ns_list[8]->controller_id=51
+subsystem_ns_list[8]->asqsz=0
+subsystem_ns_list[8]->dhcp_root_path_string=(null)
+subsystem_ns_list[8]->discovered=1
+subsystem_ns_list[8]->unavailable=0
+subsystem_ns_list[9]->index=10
+subsystem_ns_list[9]->discovery->index=2
+subsystem_ns_list[9]->num_hfis=1
+subsystem_ns_list[9]->hfis[0]->index=2
+subsystem_ns_list[9]->transport=tcp
+subsystem_ns_list[9]->traddr=172.18.230.61
+subsystem_ns_list[9]->trsvcid=4420
+subsystem_ns_list[9]->subsys_port_id=0
+subsystem_ns_list[9]->nsid=1671
+subsystem_ns_list[9]->nid_type=2
+subsystem_ns_list[9]->nid=f4c66fce74afdb8ccf96807eaeae
+subsystem_ns_list[9]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[9]->pdu_header_digest_required=0
+subsystem_ns_list[9]->data_digest_required=0
+subsystem_ns_list[9]->controller_id=51
+subsystem_ns_list[9]->asqsz=0
+subsystem_ns_list[9]->dhcp_root_path_string=(null)
+subsystem_ns_list[9]->discovered=1
+subsystem_ns_list[9]->unavailable=0
+subsystem_ns_list[10]->index=11
+subsystem_ns_list[10]->discovery->index=2
+subsystem_ns_list[10]->num_hfis=1
+subsystem_ns_list[10]->hfis[0]->index=2
+subsystem_ns_list[10]->transport=tcp
+subsystem_ns_list[10]->traddr=172.18.230.60
+subsystem_ns_list[10]->trsvcid=4420
+subsystem_ns_list[10]->subsys_port_id=0
+subsystem_ns_list[10]->nsid=270
+subsystem_ns_list[10]->nid_type=2
+subsystem_ns_list[10]->nid=5380b42fc0c5de718ccf9680be3ca7
+subsystem_ns_list[10]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[10]->pdu_header_digest_required=0
+subsystem_ns_list[10]->data_digest_required=0
+subsystem_ns_list[10]->controller_id=4185
+subsystem_ns_list[10]->asqsz=0
+subsystem_ns_list[10]->dhcp_root_path_string=(null)
+subsystem_ns_list[10]->discovered=1
+subsystem_ns_list[10]->unavailable=0
+subsystem_ns_list[11]->index=12
+subsystem_ns_list[11]->discovery->index=2
+subsystem_ns_list[11]->num_hfis=1
+subsystem_ns_list[11]->hfis[0]->index=2
+subsystem_ns_list[11]->transport=tcp
+subsystem_ns_list[11]->traddr=172.18.230.60
+subsystem_ns_list[11]->trsvcid=4420
+subsystem_ns_list[11]->subsys_port_id=0
+subsystem_ns_list[11]->nsid=1671
+subsystem_ns_list[11]->nid_type=2
+subsystem_ns_list[11]->nid=f4c66fce74afdb8ccf96807eaeae
+subsystem_ns_list[11]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:88b402df2d762AA7AF94
+subsystem_ns_list[11]->pdu_header_digest_required=0
+subsystem_ns_list[11]->data_digest_required=0
+subsystem_ns_list[11]->controller_id=4185
+subsystem_ns_list[11]->asqsz=0
+subsystem_ns_list[11]->dhcp_root_path_string=(null)
+subsystem_ns_list[11]->discovered=1
+subsystem_ns_list[11]->unavailable=0
+subsystem_ns_list[12]->index=13
+subsystem_ns_list[12]->discovery->index=2
+subsystem_ns_list[12]->num_hfis=1
+subsystem_ns_list[12]->hfis[0]->index=2
+subsystem_ns_list[12]->transport=tcp
+subsystem_ns_list[12]->traddr=172.18.230.51
+subsystem_ns_list[12]->trsvcid=4420
+subsystem_ns_list[12]->subsys_port_id=0
+subsystem_ns_list[12]->nsid=1
+subsystem_ns_list[12]->nid_type=3
+subsystem_ns_list[12]->nid=6be5e52f7fa24d57805b8cdce240e4c
+subsystem_ns_list[12]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[12]->pdu_header_digest_required=0
+subsystem_ns_list[12]->data_digest_required=0
+subsystem_ns_list[12]->controller_id=6273
+subsystem_ns_list[12]->asqsz=0
+subsystem_ns_list[12]->dhcp_root_path_string=(null)
+subsystem_ns_list[12]->discovered=1
+subsystem_ns_list[12]->unavailable=0
+subsystem_ns_list[13]->index=14
+subsystem_ns_list[13]->discovery->index=2
+subsystem_ns_list[13]->num_hfis=1
+subsystem_ns_list[13]->hfis[0]->index=2
+subsystem_ns_list[13]->transport=tcp
+subsystem_ns_list[13]->traddr=172.18.230.50
+subsystem_ns_list[13]->trsvcid=4420
+subsystem_ns_list[13]->subsys_port_id=0
+subsystem_ns_list[13]->nsid=1
+subsystem_ns_list[13]->nid_type=3
+subsystem_ns_list[13]->nid=6be5e52f7fa24d57805b8cdce240e4c
+subsystem_ns_list[13]->subsys_nqn=nqn.1992-08.com.netapp:sn.643ecb551e6b11eda647d039ea98949f:subsystem.dellr660
+subsystem_ns_list[13]->pdu_header_digest_required=0
+subsystem_ns_list[13]->data_digest_required=0
+subsystem_ns_list[13]->controller_id=6272
+subsystem_ns_list[13]->asqsz=0
+subsystem_ns_list[13]->dhcp_root_path_string=(null)
+subsystem_ns_list[13]->discovered=1
+subsystem_ns_list[13]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single b/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
index 72a34de..17631fb 100644
--- a/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
+++ b/test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
@@ -36,6 +36,8 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=4105
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
subsystem_ns_list[1]->index=2
subsystem_ns_list[1]->num_hfis=1
subsystem_ns_list[1]->hfis[0]->index=1
@@ -52,3 +54,5 @@ subsystem_ns_list[1]->data_digest_required=0
subsystem_ns_list[1]->controller_id=4105
subsystem_ns_list[1]->asqsz=0
subsystem_ns_list[1]->dhcp_root_path_string=(null)
+subsystem_ns_list[1]->discovered=0
+subsystem_ns_list[1]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-Dell.PowerEdge.R760 b/test/nbft/diffs/NBFT-Dell.PowerEdge.R760
index d7fab3f..5bb854c 100644
--- a/test/nbft/diffs/NBFT-Dell.PowerEdge.R760
+++ b/test/nbft/diffs/NBFT-Dell.PowerEdge.R760
@@ -41,6 +41,8 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=5
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=1
+subsystem_ns_list[0]->unavailable=0
subsystem_ns_list[1]->index=2
subsystem_ns_list[1]->discovery->index=1
subsystem_ns_list[1]->num_hfis=1
@@ -58,3 +60,5 @@ subsystem_ns_list[1]->data_digest_required=0
subsystem_ns_list[1]->controller_id=4166
subsystem_ns_list[1]->asqsz=0
subsystem_ns_list[1]->dhcp_root_path_string=(null)
+subsystem_ns_list[1]->discovered=1
+subsystem_ns_list[1]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-auto-ipv6 b/test/nbft/diffs/NBFT-auto-ipv6
index 83ee643..4e19830 100644
--- a/test/nbft/diffs/NBFT-auto-ipv6
+++ b/test/nbft/diffs/NBFT-auto-ipv6
@@ -36,3 +36,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=1
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-dhcp-ipv4 b/test/nbft/diffs/NBFT-dhcp-ipv4
index 067079d..4c9c61c 100644
--- a/test/nbft/diffs/NBFT-dhcp-ipv4
+++ b/test/nbft/diffs/NBFT-dhcp-ipv4
@@ -41,3 +41,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=7
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=1
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-dhcp-ipv6 b/test/nbft/diffs/NBFT-dhcp-ipv6
index 11c974f..27c54fd 100644
--- a/test/nbft/diffs/NBFT-dhcp-ipv6
+++ b/test/nbft/diffs/NBFT-dhcp-ipv6
@@ -36,3 +36,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=34
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-mpath+disc-ipv4+6_half b/test/nbft/diffs/NBFT-mpath+disc-ipv4+6_half
new file mode 100644
index 0000000..1e1d678
--- /dev/null
+++ b/test/nbft/diffs/NBFT-mpath+disc-ipv4+6_half
@@ -0,0 +1,141 @@
+raw_nbft_size=1922
+host.id=12345678abcdabcdabcd123456789012
+host.nqn=nqn.2014-08.org.nvmexpress:uuid:12345678-abcd-abcd-abcd-123456789012
+host.host_id_configured=1
+host.host_nqn_configured=1
+host.primary=0
+hfi_list[0]->index=1
+hfi_list[0]->transport=tcp
+hfi_list[0]->tcp_info.pci_sbdf=24
+hfi_list[0]->tcp_info.mac_addr=5254072c5ae
+hfi_list[0]->tcp_info.vlan=0
+hfi_list[0]->tcp_info.ip_origin=1
+hfi_list[0]->tcp_info.ipaddr=192.168.122.158
+hfi_list[0]->tcp_info.subnet_mask_prefix=24
+hfi_list[0]->tcp_info.gateway_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.route_metric=0
+hfi_list[0]->tcp_info.primary_dns_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.secondary_dns_ipaddr=0.0.0.0
+hfi_list[0]->tcp_info.dhcp_server_ipaddr=
+hfi_list[0]->tcp_info.host_name=(null)
+hfi_list[0]->tcp_info.this_hfi_is_default_route=1
+hfi_list[0]->tcp_info.dhcp_override=0
+hfi_list[1]->index=2
+hfi_list[1]->transport=tcp
+hfi_list[1]->tcp_info.pci_sbdf=32
+hfi_list[1]->tcp_info.mac_addr=5254072c5af
+hfi_list[1]->tcp_info.vlan=0
+hfi_list[1]->tcp_info.ip_origin=1
+hfi_list[1]->tcp_info.ipaddr=4321::bbbb:2
+hfi_list[1]->tcp_info.subnet_mask_prefix=0
+hfi_list[1]->tcp_info.gateway_ipaddr=::
+hfi_list[1]->tcp_info.route_metric=0
+hfi_list[1]->tcp_info.primary_dns_ipaddr=::
+hfi_list[1]->tcp_info.secondary_dns_ipaddr=::
+hfi_list[1]->tcp_info.dhcp_server_ipaddr=
+hfi_list[1]->tcp_info.host_name=(null)
+hfi_list[1]->tcp_info.this_hfi_is_default_route=1
+hfi_list[1]->tcp_info.dhcp_override=0
+discovery_list[0]->index=1
+discovery_list[0]->hfi->index=1
+discovery_list[0]->uri=nvme+tcp://192.168.122.1:4420/
+discovery_list[0]->nqn=nqn.2014-08.org.nvmexpress.discovery
+discovery_list[1]->index=2
+discovery_list[1]->hfi->index=2
+discovery_list[1]->uri=nvme+tcp://[4321::BBBB:1]:4420/
+discovery_list[1]->nqn=nqn.2014-08.org.nvmexpress.discovery
+subsystem_ns_list[0]->index=1
+subsystem_ns_list[0]->discovery->index=1
+subsystem_ns_list[0]->num_hfis=1
+subsystem_ns_list[0]->hfis[0]->index=1
+subsystem_ns_list[0]->transport=tcp
+subsystem_ns_list[0]->traddr=192.168.122.1
+subsystem_ns_list[0]->trsvcid=4420
+subsystem_ns_list[0]->subsys_port_id=0
+subsystem_ns_list[0]->nsid=123
+subsystem_ns_list[0]->nid_type=3
+subsystem_ns_list[0]->nid=d592cdf3ffffffff84123fcf7d99df27
+subsystem_ns_list[0]->subsys_nqn=nqn.2014-08.org.nvmexpress.boot.poc:test-target
+subsystem_ns_list[0]->pdu_header_digest_required=0
+subsystem_ns_list[0]->data_digest_required=0
+subsystem_ns_list[0]->controller_id=0
+subsystem_ns_list[0]->asqsz=0
+subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=1
+subsystem_ns_list[0]->unavailable=0
+subsystem_ns_list[1]->index=2
+subsystem_ns_list[1]->discovery->index=1
+subsystem_ns_list[1]->num_hfis=1
+subsystem_ns_list[1]->hfis[0]->index=1
+subsystem_ns_list[1]->transport=tcp
+subsystem_ns_list[1]->traddr=192.168.122.1
+subsystem_ns_list[1]->trsvcid=4420
+subsystem_ns_list[1]->subsys_port_id=0
+subsystem_ns_list[1]->nsid=201
+subsystem_ns_list[1]->nid_type=3
+subsystem_ns_list[1]->nid=9b9e1b6ea02c427fbdeb2a0be9cb945
+subsystem_ns_list[1]->subsys_nqn=nqn.2014-08.org.nvmexpress.boot.poc:test-target
+subsystem_ns_list[1]->pdu_header_digest_required=0
+subsystem_ns_list[1]->data_digest_required=0
+subsystem_ns_list[1]->controller_id=0
+subsystem_ns_list[1]->asqsz=0
+subsystem_ns_list[1]->dhcp_root_path_string=(null)
+subsystem_ns_list[1]->discovered=1
+subsystem_ns_list[1]->unavailable=0
+subsystem_ns_list[2]->index=3
+subsystem_ns_list[2]->discovery->index=1
+subsystem_ns_list[2]->num_hfis=1
+subsystem_ns_list[2]->hfis[0]->index=1
+subsystem_ns_list[2]->transport=tcp
+subsystem_ns_list[2]->traddr=192.168.122.1
+subsystem_ns_list[2]->trsvcid=4420
+subsystem_ns_list[2]->subsys_port_id=0
+subsystem_ns_list[2]->nsid=202
+subsystem_ns_list[2]->nid_type=3
+subsystem_ns_list[2]->nid=5353d4e551a40f492a563231b833c5
+subsystem_ns_list[2]->subsys_nqn=nqn.2014-08.org.nvmexpress.boot.poc:test-target
+subsystem_ns_list[2]->pdu_header_digest_required=0
+subsystem_ns_list[2]->data_digest_required=0
+subsystem_ns_list[2]->controller_id=0
+subsystem_ns_list[2]->asqsz=0
+subsystem_ns_list[2]->dhcp_root_path_string=(null)
+subsystem_ns_list[2]->discovered=1
+subsystem_ns_list[2]->unavailable=0
+subsystem_ns_list[3]->index=4
+subsystem_ns_list[3]->discovery->index=1
+subsystem_ns_list[3]->num_hfis=1
+subsystem_ns_list[3]->hfis[0]->index=1
+subsystem_ns_list[3]->transport=tcp
+subsystem_ns_list[3]->traddr=192.168.122.1
+subsystem_ns_list[3]->trsvcid=4420
+subsystem_ns_list[3]->subsys_port_id=0
+subsystem_ns_list[3]->nsid=203
+subsystem_ns_list[3]->nid_type=3
+subsystem_ns_list[3]->nid=fb13e6ffac2940c0a988cb1c17d39f4b
+subsystem_ns_list[3]->subsys_nqn=nqn.2014-08.org.nvmexpress.boot.poc:test-target
+subsystem_ns_list[3]->pdu_header_digest_required=0
+subsystem_ns_list[3]->data_digest_required=0
+subsystem_ns_list[3]->controller_id=0
+subsystem_ns_list[3]->asqsz=0
+subsystem_ns_list[3]->dhcp_root_path_string=(null)
+subsystem_ns_list[3]->discovered=1
+subsystem_ns_list[3]->unavailable=0
+subsystem_ns_list[4]->index=5
+subsystem_ns_list[4]->discovery->index=2
+subsystem_ns_list[4]->num_hfis=1
+subsystem_ns_list[4]->hfis[0]->index=2
+subsystem_ns_list[4]->transport=tcp
+subsystem_ns_list[4]->traddr=4321::bbbb:1
+subsystem_ns_list[4]->trsvcid=4420
+subsystem_ns_list[4]->subsys_port_id=0
+subsystem_ns_list[4]->nsid=0
+subsystem_ns_list[4]->nid_type=0
+subsystem_ns_list[4]->nid=0000000000000000
+subsystem_ns_list[4]->subsys_nqn=nqn.2014-08.org.nvmexpress.discovery
+subsystem_ns_list[4]->pdu_header_digest_required=0
+subsystem_ns_list[4]->data_digest_required=0
+subsystem_ns_list[4]->controller_id=0
+subsystem_ns_list[4]->asqsz=0
+subsystem_ns_list[4]->dhcp_root_path_string=(null)
+subsystem_ns_list[4]->discovered=1
+subsystem_ns_list[4]->unavailable=1
diff --git a/test/nbft/diffs/NBFT-rhpoc b/test/nbft/diffs/NBFT-rhpoc
index d849b6e..027ea40 100644
--- a/test/nbft/diffs/NBFT-rhpoc
+++ b/test/nbft/diffs/NBFT-rhpoc
@@ -36,3 +36,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=12
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-static-ipv4 b/test/nbft/diffs/NBFT-static-ipv4
index a6f3859..697d0e5 100644
--- a/test/nbft/diffs/NBFT-static-ipv4
+++ b/test/nbft/diffs/NBFT-static-ipv4
@@ -36,3 +36,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=38
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-static-ipv4-discovery b/test/nbft/diffs/NBFT-static-ipv4-discovery
index 5bf0e46..22473a0 100644
--- a/test/nbft/diffs/NBFT-static-ipv4-discovery
+++ b/test/nbft/diffs/NBFT-static-ipv4-discovery
@@ -41,3 +41,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=13
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=1
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/diffs/NBFT-static-ipv6 b/test/nbft/diffs/NBFT-static-ipv6
index c6ad844..12554f5 100644
--- a/test/nbft/diffs/NBFT-static-ipv6
+++ b/test/nbft/diffs/NBFT-static-ipv6
@@ -36,3 +36,5 @@ subsystem_ns_list[0]->data_digest_required=0
subsystem_ns_list[0]->controller_id=9
subsystem_ns_list[0]->asqsz=0
subsystem_ns_list[0]->dhcp_root_path_string=(null)
+subsystem_ns_list[0]->discovered=0
+subsystem_ns_list[0]->unavailable=0
diff --git a/test/nbft/meson.build b/test/nbft/meson.build
index 919bf83..7882df6 100644
--- a/test/nbft/meson.build
+++ b/test/nbft/meson.build
@@ -19,7 +19,9 @@ tables = [
'NBFT-static-ipv4-discovery',
'NBFT-static-ipv6',
'NBFT-Dell.PowerEdge.R760',
- 'NBFT-Dell.PowerEdge.R660-fw1.5.5-single'
+ 'NBFT-Dell.PowerEdge.R660-fw1.5.5-single',
+ 'NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery',
+ 'NBFT-mpath+disc-ipv4+6_half'
]
tables_bad = [
diff --git a/test/nbft/nbft-dump.c b/test/nbft/nbft-dump.c
index 3ff5efa..5fb2f2e 100644
--- a/test/nbft/nbft-dump.c
+++ b/test/nbft/nbft-dump.c
@@ -96,6 +96,8 @@ static void print_nbft(struct nbft_info *table)
printf("subsystem_ns_list[%u]->controller_id=%d\n", i, (*ssns)->controller_id);
printf("subsystem_ns_list[%u]->asqsz=%d\n", i, (*ssns)->asqsz);
printf("subsystem_ns_list[%u]->dhcp_root_path_string=%s\n", i, (*ssns)->dhcp_root_path_string);
+ printf("subsystem_ns_list[%u]->discovered=%d\n", i, (*ssns)->discovered);
+ printf("subsystem_ns_list[%u]->unavailable=%d\n", i, (*ssns)->unavailable);
}
}
diff --git a/test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery b/test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery
new file mode 100644
index 0000000..0fbb35c
--- /dev/null
+++ b/test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-mpath+discovery
Binary files differ
diff --git a/test/nbft/tables/NBFT-mpath+disc-ipv4+6_half b/test/nbft/tables/NBFT-mpath+disc-ipv4+6_half
new file mode 100644
index 0000000..13333b1
--- /dev/null
+++ b/test/nbft/tables/NBFT-mpath+disc-ipv4+6_half
Binary files differ
diff --git a/test/register.c b/test/register.c
index 8a41628..1fb692b 100644
--- a/test/register.c
+++ b/test/register.c
@@ -79,10 +79,13 @@ void nvme_print_registers(void *regs)
printf(" %-8s : %llx\n", "NSSRC", NVME_CAP_NSSRC(cap));
printf(" %-8s : %llx\n", "CSS", NVME_CAP_CSS(cap));
printf(" %-8s : %llx\n", "BPS", NVME_CAP_BPS(cap));
+ printf(" %-8s : %llx\n", "CPS", NVME_CAP_CPS(cap));
printf(" %-8s : %llx\n", "MPSMIN", NVME_CAP_MPSMIN(cap));
printf(" %-8s : %llx\n", "MPSMAX", NVME_CAP_MPSMAX(cap));
- printf(" %-8s : %llx\n", "CMBS", NVME_CAP_CMBS(cap));
printf(" %-8s : %llx\n", "PMRS", NVME_CAP_PMRS(cap));
+ printf(" %-8s : %llx\n", "CMBS", NVME_CAP_CMBS(cap));
+ printf(" %-8s : %llx\n", "NSSS", NVME_CAP_NSSS(cap));
+ printf(" %-8s : %llx\n", "CRMS", NVME_CAP_CRMS(cap));
printf("%-10s : %x\n", "VS", vs);
printf(" %-8s : %x\n", "MJR", NVME_VS_TER(vs));
@@ -107,6 +110,7 @@ void nvme_print_registers(void *regs)
printf(" %-8s : %x\n", "SHST", NVME_CSTS_SHST(csts));
printf(" %-8s : %x\n", "NSSRO", NVME_CSTS_NSSRO(csts));
printf(" %-8s : %x\n", "PP", NVME_CSTS_PP(csts));
+ printf(" %-8s : %x\n", "ST", NVME_CSTS_ST(csts));
printf("%-10s : %x\n", "NSSR", nssr);
@@ -162,7 +166,7 @@ void nvme_print_registers(void *regs)
printf(" %-8s : %x\n", "WDS", NVME_PMRCAP_WDS(pmrcap));
printf(" %-8s : %x\n", "BIR", NVME_PMRCAP_BIR(pmrcap));
printf(" %-8s : %x\n", "PMRTU", NVME_PMRCAP_PMRTU(pmrcap));
- printf(" %-8s : %x\n", "PMRWMB", NVME_PMRCAP_PMRWMB(pmrcap));
+ printf(" %-8s : %x\n", "PMRWBM", NVME_PMRCAP_PMRWBM(pmrcap));
printf(" %-8s : %x\n", "PMRTO", NVME_PMRCAP_PMRTO(pmrcap));
printf(" %-8s : %x\n", "CMSS", NVME_PMRCAP_CMSS(pmrcap));
diff --git a/test/sysfs/meson.build b/test/sysfs/meson.build
index c004fc0..119fa97 100644
--- a/test/sysfs/meson.build
+++ b/test/sysfs/meson.build
@@ -5,25 +5,32 @@
#
# Authors: Daniel Wagner <dwagner@suse.de>
+diff = find_program('diff', required : false)
+if diff.found()
+ sysfs_tree_print = executable(
+ 'sysfs-tree-print',
+ ['sysfs.c'],
+ dependencies: libnvme_dep,
+ include_directories: [incdir],
+ )
-sysfs = executable(
- 'test-sysfs',
- ['sysfs.c'],
- dependencies: libnvme_dep,
- include_directories: [incdir, internal_incdir]
-)
+ sysfs_files= [
+ 'nvme-sysfs-tw-carbon-6.8.0-rc1+'
+ ]
-sysfs_files= [
- 'nvme-sysfs-tw-carbon-6.8.0-rc1+'
-]
+ sysfs_tree_diff = find_program('sysfs-tree-diff.sh')
-setup = find_program('setup.sh')
-
-foreach t_file : sysfs_files
- r = run_command(setup, files('data'/t_file + '.tar.xz'), meson.current_build_dir(), check: true)
- i = r.stdout().strip()
- e0 = 'LIBNVME_SYSFS_PATH=' + i
- e1 = 'LIBNVME_HOSTNQN=nqn.2014-08.org.nvmexpress:uuid:ce4fee3e-c02c-11ee-8442-830d068a36c6'
- e2 = 'LIBNVME_HOSTID=ce4fee3e-c02c-11ee-8442-830d068a36c6'
- test('sysfs', sysfs, args : [ i, t_file + '.out', files('data'/t_file + '.out') ], env : [ e0, e1, e2 ])
-endforeach
+ foreach t_file : sysfs_files
+ test(
+ 'sysfs',
+ sysfs_tree_diff,
+ args : [
+ meson.current_build_dir(),
+ sysfs_tree_print.full_path(),
+ files('data'/t_file + '.tar.xz'),
+ files('data'/t_file + '.out'),
+ ],
+ depends : sysfs_tree_print,
+ )
+ endforeach
+endif
diff --git a/test/sysfs/setup.sh b/test/sysfs/setup.sh
deleted file mode 100755
index 3437d4e..0000000
--- a/test/sysfs/setup.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-TARFILE=$1
-BASEDIR=$2
-TESTDIR="$BASEDIR/$(basename -s .tar.xz ${TARFILE})"
-
-mkdir -p "${TESTDIR}"
-tar -x -f "${TARFILE}" -C "${TESTDIR}" || exit 1
-
-echo "${TESTDIR}"
diff --git a/test/sysfs/sysfs-tree-diff.sh b/test/sysfs/sysfs-tree-diff.sh
new file mode 100644
index 0000000..dfe3cb3
--- /dev/null
+++ b/test/sysfs/sysfs-tree-diff.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -e
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+BUILD_DIR=$1
+SYSFS_TREE_PRINT=$2
+INPUT=$3
+EXPECTED_OUTPUT=$4
+
+TEST_NAME="$(basename -s .tar.xz $INPUT)"
+TEST_DIR="$BUILD_DIR/$TEST_NAME"
+ACTUAL_OUTPUT="$TEST_DIR.out"
+
+rm -rf "$TEST_DIR"
+mkdir "$TEST_DIR"
+tar -x -f "$INPUT" -C "$TEST_DIR"
+
+LIBNVME_SYSFS_PATH="$TEST_DIR" \
+LIBNVME_HOSTNQN=nqn.2014-08.org.nvmexpress:uuid:ce4fee3e-c02c-11ee-8442-830d068a36c6 \
+LIBNVME_HOSTID=ce4fee3e-c02c-11ee-8442-830d068a36c6 \
+"$SYSFS_TREE_PRINT" > "$ACTUAL_OUTPUT"
+
+diff -u "$EXPECTED_OUTPUT" "$ACTUAL_OUTPUT"
diff --git a/test/sysfs/sysfs.c b/test/sysfs/sysfs.c
index c2df178..06d0035 100644
--- a/test/sysfs/sysfs.c
+++ b/test/sysfs/sysfs.c
@@ -4,86 +4,21 @@
* Copyright (c) 2024 Daniel Wagner, SUSE LLC
*/
-#include "nvme/tree.h"
#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-
-#include <ccan/array_size/array_size.h>
#include <libnvme.h>
-#include <nvme/private.h>
-static bool test_sysfs(const char *path, const char *filename)
+int main(int argc, char *argv[])
{
- FILE *f;
nvme_root_t r;
- int err;
-
- f = fopen(filename, "w");
- if (!f)
- return false;
- r = nvme_create_root(f, LOG_ERR);
+ r = nvme_create_root(stdout, LOG_ERR);
assert(r);
- err = nvme_scan_topology(r, NULL, NULL);
- if (!err)
- nvme_dump_tree(r);
- fprintf(f, "\n");
-
- nvme_free_tree(r);
- fclose(f);
-
- return err == 0;
-}
-
-static bool compare_content(const char *filename1, const char *filename2)
-{
- FILE *f1, *f2;
- char c1, c2;
- bool pass = false;
-
- f1 = fopen(filename1, "r");
- if (!f1)
- return false;
+ assert(nvme_scan_topology(r, NULL, NULL) == 0);
- f2 = fopen(filename2, "r");
- if (!f2) {
- fclose(f1);
- return false;
- }
+ assert(nvme_dump_tree(r) == 0);
+ printf("\n");
- do {
- c1 = getc(f1);
- c2 = getc(f2);
- if (c1 != c2)
- goto out;
- } while (c1 != EOF || c2 != EOF);
-
- if (c1 == c2)
- pass = true;
-out:
- fclose(f1);
- fclose(f2);
-
- return pass;
-}
-
-int main(int argc, char *argv[])
-{
- bool pass = true;
-
- if (argc < 4) {
- fprintf(stderr, "usage: test-sysfs SYSFS_DIR OUTPUT_FILE COMPARE_FILE\n");
- return EXIT_FAILURE;
- }
-
- pass &= test_sysfs(argv[1], argv[2]);
- pass &= compare_content(argv[2], argv[3]);
-
- exit(pass ? EXIT_SUCCESS : EXIT_FAILURE);
+ nvme_free_tree(r);
}
diff --git a/test/test-util.c b/test/test-util.c
index 88a3f42..6bee89b 100644
--- a/test/test-util.c
+++ b/test/test-util.c
@@ -89,6 +89,58 @@ static bool test_ipaddrs_eq() {
return test_success;
}
+static bool test_nvme_id_ns_flbas_to_lbaf_inuse() {
+ const __u8 flbas[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
+ };
+ const __u8 inuse[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
+ };
+ __u8 test_in_use;
+ bool result, test_success = true;
+
+ for (int i = 0; i < sizeof(flbas); i++) {
+ nvme_id_ns_flbas_to_lbaf_inuse(flbas[i], &test_in_use);
+ result = (test_in_use == inuse[i] ? true : false);
+ printf("flbas = 0x%02x, inuse = 0x%02x (expect = 0x%02x) %s\n",
+ flbas[i], test_in_use, inuse[i],
+ result ? "[PASS]" : "[FAIL]");
+ if (!result)
+ test_success = false;
+ }
+ return test_success;
+}
+
int main(int argc, char *argv[]) {
int exit_val = EXIT_SUCCESS;
bool pass;
@@ -117,5 +169,11 @@ int main(int argc, char *argv[]) {
if (!pass)
exit_val = EXIT_FAILURE;
+ printf("\n------------------------------------------------------------------------------\n");
+ pass = test_nvme_id_ns_flbas_to_lbaf_inuse();
+ printf("nvme_id_ns_flbas_to_lbaf_inuse() %s\n", pass ? "[PASS]" : "[FAIL]");
+ if (!pass)
+ exit_val = EXIT_FAILURE;
+
exit(exit_val);
}