Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
857e875fe5
commit
67e5308a54
874 changed files with 1460 additions and 897 deletions
|
@ -97,3 +97,7 @@ endif
|
|||
|
||||
subdir('ioctl')
|
||||
subdir('nbft')
|
||||
|
||||
if json_c_dep.found()
|
||||
subdir('sysfs')
|
||||
endif
|
||||
|
|
|
@ -306,7 +306,7 @@ static void test_invalid_crc(nvme_mi_ep_t ep)
|
|||
|
||||
test_set_transport_callback(ep, test_invalid_crc_cb, NULL);
|
||||
rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);
|
||||
assert(rc != 0);
|
||||
assert(rc < 0);
|
||||
}
|
||||
|
||||
/* test: test that the controller list populates the endpoint's list of
|
||||
|
|
54
test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
Normal file
54
test/nbft/diffs/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
Normal file
|
@ -0,0 +1,54 @@
|
|||
raw_nbft_size=930
|
||||
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=94
|
||||
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
|
||||
subsystem_ns_list[0]->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=4105
|
||||
subsystem_ns_list[0]->asqsz=0
|
||||
subsystem_ns_list[0]->dhcp_root_path_string=(null)
|
||||
subsystem_ns_list[1]->index=2
|
||||
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=4105
|
||||
subsystem_ns_list[1]->asqsz=0
|
||||
subsystem_ns_list[1]->dhcp_root_path_string=(null)
|
60
test/nbft/diffs/NBFT-Dell.PowerEdge.R760
Normal file
60
test/nbft/diffs/NBFT-Dell.PowerEdge.R760
Normal file
|
@ -0,0 +1,60 @@
|
|||
raw_nbft_size=1017
|
||||
host.id=44454c4c34010368038b2c04f313233
|
||||
host.nqn=nqn.1988-11.com.dell:PowerEdge.R760.1234567
|
||||
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=16384
|
||||
hfi_list[0]->tcp_info.mac_addr=b02628e87ce
|
||||
hfi_list[0]->tcp_info.vlan=0
|
||||
hfi_list[0]->tcp_info.ip_origin=82
|
||||
hfi_list[0]->tcp_info.ipaddr=100.71.245.232
|
||||
hfi_list[0]->tcp_info.subnet_mask_prefix=24
|
||||
hfi_list[0]->tcp_info.gateway_ipaddr=100.71.245.254
|
||||
hfi_list[0]->tcp_info.route_metric=500
|
||||
hfi_list[0]->tcp_info.primary_dns_ipaddr=100.64.0.5
|
||||
hfi_list[0]->tcp_info.secondary_dns_ipaddr=100.64.0.6
|
||||
hfi_list[0]->tcp_info.dhcp_server_ipaddr=100.71.245.254
|
||||
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=1
|
||||
discovery_list[0]->index=1
|
||||
discovery_list[0]->hfi->index=1
|
||||
discovery_list[0]->uri=nvme+tcp://100.71.103.50:8009/
|
||||
discovery_list[0]->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=100.71.103.48
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
subsystem_ns_list[0]->subsys_port_id=0
|
||||
subsystem_ns_list[0]->nsid=148
|
||||
subsystem_ns_list[0]->nid_type=2
|
||||
subsystem_ns_list[0]->nid=c8244ed9c15f53b8ccf96802efca
|
||||
subsystem_ns_list[0]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:2a64abf1c5b81F6C4549
|
||||
subsystem_ns_list[0]->pdu_header_digest_required=0
|
||||
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[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=100.71.103.49
|
||||
subsystem_ns_list[1]->trsvcid=4420
|
||||
subsystem_ns_list[1]->subsys_port_id=0
|
||||
subsystem_ns_list[1]->nsid=148
|
||||
subsystem_ns_list[1]->nid_type=2
|
||||
subsystem_ns_list[1]->nid=c8244ed9c15f53b8ccf96802efca
|
||||
subsystem_ns_list[1]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:2a64abf1c5b81F6C4549
|
||||
subsystem_ns_list[1]->pdu_header_digest_required=0
|
||||
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)
|
|
@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|||
subsystem_ns_list[0]->index=1
|
||||
subsystem_ns_list[0]->num_hfis=1
|
||||
subsystem_ns_list[0]->hfis[0]->index=1
|
||||
subsystem_ns_list[0]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=fd09:9a46:b5c1:1ff:5054:ff:fefd:9e66
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -28,7 +28,6 @@ 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]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=192.168.49.10
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=1
|
|||
subsystem_ns_list[0]->index=1
|
||||
subsystem_ns_list[0]->num_hfis=1
|
||||
subsystem_ns_list[0]->hfis[0]->index=1
|
||||
subsystem_ns_list[0]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=fddf:d:f:49::10
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|||
subsystem_ns_list[0]->index=1
|
||||
subsystem_ns_list[0]->num_hfis=1
|
||||
subsystem_ns_list[0]->hfis[0]->index=1
|
||||
subsystem_ns_list[0]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=192.168.101.20
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|||
subsystem_ns_list[0]->index=1
|
||||
subsystem_ns_list[0]->num_hfis=1
|
||||
subsystem_ns_list[0]->hfis[0]->index=1
|
||||
subsystem_ns_list[0]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=192.168.49.10
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -28,7 +28,6 @@ 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]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=192.168.49.10
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|||
subsystem_ns_list[0]->index=1
|
||||
subsystem_ns_list[0]->num_hfis=1
|
||||
subsystem_ns_list[0]->hfis[0]->index=1
|
||||
subsystem_ns_list[0]->hfis[1]->index=1
|
||||
subsystem_ns_list[0]->transport=tcp
|
||||
subsystem_ns_list[0]->traddr=fd09:9a46:b5c1:1fe::13f
|
||||
subsystem_ns_list[0]->trsvcid=4420
|
||||
|
|
|
@ -18,6 +18,8 @@ tables = [
|
|||
'NBFT-static-ipv4',
|
||||
'NBFT-static-ipv4-discovery',
|
||||
'NBFT-static-ipv6',
|
||||
'NBFT-Dell.PowerEdge.R760',
|
||||
'NBFT-Dell.PowerEdge.R660-fw1.5.5-single'
|
||||
]
|
||||
|
||||
tables_bad = [
|
||||
|
|
BIN
test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
Normal file
BIN
test/nbft/tables/NBFT-Dell.PowerEdge.R660-fw1.5.5-single
Normal file
Binary file not shown.
1
test/nbft/tables/NBFT-Dell.PowerEdge.R760
Symbolic link
1
test/nbft/tables/NBFT-Dell.PowerEdge.R760
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../libnvme/tests/NBFT
|
32
test/sysfs/data/nvme-sysfs-tw-carbon-6.8.0-rc1+.out
Normal file
32
test/sysfs/data/nvme-sysfs-tw-carbon-6.8.0-rc1+.out
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"hosts":[
|
||||
{
|
||||
"hostnqn":"nqn.2014-08.org.nvmexpress:uuid:ce4fee3e-c02c-11ee-8442-830d068a36c6",
|
||||
"hostid":"ce4fee3e-c02c-11ee-8442-830d068a36c6",
|
||||
"subsystems":[
|
||||
{
|
||||
"name":"nvme-subsys1",
|
||||
"nqn":"nqn.2019-08.org.qemu:nvme-0",
|
||||
"controllers":[
|
||||
{
|
||||
"name":"nvme1",
|
||||
"transport":"pcie",
|
||||
"traddr":"0000:00:05.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"nvme-subsys0",
|
||||
"nqn":"nqn.2019-08.org.qemu:subsys1",
|
||||
"controllers":[
|
||||
{
|
||||
"name":"nvme0",
|
||||
"transport":"pcie",
|
||||
"traddr":"0000:0f:00.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
BIN
test/sysfs/data/nvme-sysfs-tw-carbon-6.8.0-rc1+.tar.xz
Normal file
BIN
test/sysfs/data/nvme-sysfs-tw-carbon-6.8.0-rc1+.tar.xz
Normal file
Binary file not shown.
29
test/sysfs/meson.build
Normal file
29
test/sysfs/meson.build
Normal file
|
@ -0,0 +1,29 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# This file is part of libnvme.
|
||||
# Copyright (c) 2024 SUSE LLC.
|
||||
#
|
||||
# Authors: Daniel Wagner <dwagner@suse.de>
|
||||
|
||||
|
||||
sysfs = executable(
|
||||
'test-sysfs',
|
||||
['sysfs.c'],
|
||||
dependencies: libnvme_dep,
|
||||
include_directories: [incdir, internal_incdir]
|
||||
)
|
||||
|
||||
sysfs_files= [
|
||||
'nvme-sysfs-tw-carbon-6.8.0-rc1+'
|
||||
]
|
||||
|
||||
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
|
11
test/sysfs/setup.sh
Executable file
11
test/sysfs/setup.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/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}"
|
89
test/sysfs/sysfs.c
Normal file
89
test/sysfs/sysfs.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
/**
|
||||
* This file is part of libnvme.
|
||||
* 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)
|
||||
{
|
||||
FILE *f;
|
||||
nvme_root_t r;
|
||||
int err;
|
||||
|
||||
f = fopen(filename, "w");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
r = nvme_create_root(f, 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;
|
||||
|
||||
f2 = fopen(filename2, "r");
|
||||
if (!f2) {
|
||||
fclose(f1);
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue