File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,5 +108,5 @@ subdir('ioctl')
108108subdir (' nbft' )
109109
110110if json_c_dep.found()
111- subdir (' sysfs' )
111+ subdir (' sysfs' )
112112endif
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 77
88diff = find_program (' diff' , required : false )
99if diff.found()
10- sysfs_tree_print = executable (
11- ' sysfs -tree-print ' ,
12- [' sysfs .c' ],
10+ tree_dump = executable (
11+ ' test -tree-dump ' ,
12+ [' tree-dump .c' ],
1313 dependencies : libnvme_dep,
1414 include_directories : [incdir],
1515 )
1616
17- sysfs_files = [
18- ' nvme-sysfs-tw-carbon-6.8.0-rc1+ '
17+ tree_data = [
18+ ' tree-pcie ' ,
1919 ]
2020
21- sysfs_tree_diff = find_program (' sysfs- tree-diff.sh' )
21+ tree_diff = find_program (' tree-diff.sh' )
2222
23- foreach t_file : sysfs_files
23+ foreach t_file : tree_data
2424 test (
25- ' sysfs ' ,
26- sysfs_tree_diff ,
25+ t_file ,
26+ tree_diff ,
2727 args : [
2828 meson .current_build_dir(),
29- sysfs_tree_print .full_path(),
29+ tree_dump .full_path(),
3030 files (' data' / t_file + ' .tar.xz' ),
3131 files (' data' / t_file + ' .out' ),
3232 ],
33- depends : sysfs_tree_print ,
33+ depends : tree_dump ,
3434 )
3535 endforeach
3636endif
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+ # SPDX-License-Identifier: LGPL-2.1-or-later
3+
4+ BUILD_DIR=$1
5+ TREE_DUMP=$2
6+ SYSFS_INPUT=$3
7+ EXPECTED_OUTPUT=$4
8+
9+ TEST_NAME=" $( basename -s .tar.xz ${SYSFS_INPUT} ) "
10+ TEST_DIR=" ${BUILD_DIR} /${TEST_NAME} "
11+ ACTUAL_OUTPUT=" ${TEST_DIR} .out"
12+
13+ rm -rf " ${TEST_DIR} "
14+ mkdir " ${TEST_DIR} "
15+ tar -x -f " ${SYSFS_INPUT} " -C " ${TEST_DIR} "
16+
17+ LIBNVME_SYSFS_PATH=" ${TEST_DIR} " \
18+ LIBNVME_HOSTNQN=nqn.2014-08.org.nvmexpress:uuid:ce4fee3e-c02c-11ee-8442-830d068a36c6 \
19+ LIBNVME_HOSTID=ce4fee3e-c02c-11ee-8442-830d068a36c6 \
20+ " ${TREE_DUMP} " > " ${ACTUAL_OUTPUT} " || echo " test failed"
21+
22+ diff -u " ${EXPECTED_OUTPUT} " " ${ACTUAL_OUTPUT} "
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: LGPL-2.1-or-later
2+ /**
3+ * This file is part of libnvme.
4+ * Copyright (c) 2024 Daniel Wagner, SUSE LLC
5+ */
6+
7+ #include <string.h>
8+ #include <stdbool.h>
9+ #include <stdlib.h>
10+ #include <errno.h>
11+
12+ #include <libnvme.h>
13+
14+ static bool tree_dump (void )
15+ {
16+ bool pass = false;
17+ nvme_root_t r ;
18+ int err ;
19+
20+ r = nvme_create_root (stdout , LOG_ERR );
21+ if (!r )
22+ return false;
23+
24+ err = nvme_scan_topology (r , NULL , NULL );
25+ if (err ) {
26+ if (errno != ENOENT )
27+ goto out ;
28+ }
29+
30+ if (nvme_dump_tree (r ))
31+ goto out ;
32+ printf ("\n" );
33+
34+ pass = true;
35+
36+ out :
37+ nvme_free_tree (r );
38+ return pass ;
39+ }
40+
41+ int main (int argc , char * argv [])
42+ {
43+ bool pass = true;
44+
45+ pass = tree_dump ();
46+ fflush (stdout );
47+
48+ exit (pass ? EXIT_SUCCESS : EXIT_FAILURE );
49+ }
You can’t perform that action at this time.
0 commit comments