diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 07:38:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-03 07:38:52 +0000 |
commit | 90cf2208656c513b78a587e3e0f1f64144c0f209 (patch) | |
tree | 003a07f93ade469ca1e876018c1a0b133b478f3b /libnvme/tests | |
parent | Releasing debian version 1.3-1. (diff) | |
download | libnvme-90cf2208656c513b78a587e3e0f1f64144c0f209.tar.xz libnvme-90cf2208656c513b78a587e3e0f1f64144c0f209.zip |
Merging upstream version 1.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnvme/tests')
-rwxr-xr-x | libnvme/tests/gc.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libnvme/tests/gc.py b/libnvme/tests/gc.py new file mode 100755 index 0000000..842a76d --- /dev/null +++ b/libnvme/tests/gc.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: LGPL-2.1-or-later +import gc +import sys +import pprint +from libnvme import nvme + +root = nvme.root() +root.log_level('debug') +print(f'root: {root}') + +host = nvme.host(root) +print(f'host: {host}') + +subsystem = host.subsystems() +print(f'subsystem: {subsystem}') + +ctrls = [] +for i in range(10): + ctrl = nvme.ctrl( + root, + subsysnqn=nvme.NVME_DISC_SUBSYS_NAME, + transport='loop', + ) + ctrls.append(ctrl) + print(f'ctrl {i}: {ctrl}') + +ns = subsystem.namespaces() if subsystem is not None else None +print(f'ns: {ns}') + +# Deleting objects in the following order would create a segmentation +# fault if it weren't for the %pythonappend in nvme.i. This test is to +# make sure garbage collection is not impacted by object deletion order. +root = None +host = None + +gc.collect() # Force garbage collection before controller/subsystem objects get deleted + +ctrls = None +subsystem= None +ns = None |