]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
test/tree.py: add test script for the python binding
authorHannes Reinecke <hare@suse.de>
Thu, 17 Jun 2021 11:08:20 +0000 (13:08 +0200)
committerHannes Reinecke <hare@suse.de>
Sat, 19 Jun 2021 11:37:02 +0000 (13:37 +0200)
Add a simple test script for the python binding which just
prints out details about the NVMe subsystem.

Signed-off-by: Hannes Reinecke <hare@suse.de>
test/tree.py [new file with mode: 0644]

diff --git a/test/tree.py b/test/tree.py
new file mode 100644 (file)
index 0000000..626a0aa
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python3
+'''
+SPDX-License-Identifier: LGPL-3.1-or-later
+
+This file is part of libnvme.
+Copyright (c) 2021 SUSE Software Solutions AG
+
+Authors: Hannes Reinecke <hare@suse.de>
+
+Scans the NVMe subsystem and prints out all found hosts,
+subsystems, and controllers
+'''
+
+import libnvme
+
+r = libnvme.nvme_root()
+for h in r.hosts():
+    print (h)
+    for s in h.subsystems():
+        print (s)
+        for c in s.controllers():
+            print (c)
+