summaryrefslogtreecommitdiffstats
path: root/tests/nvme_dsm_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 18:27:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-16 15:11:56 +0000
commit6197903bd42478987516bc4cc3f0769488a37065 (patch)
tree508d399340039960289dd1d96696db7c56c22321 /tests/nvme_dsm_test.py
parentAdding upstream version 1.16. (diff)
downloadnvme-cli-6197903bd42478987516bc4cc3f0769488a37065.tar.xz
nvme-cli-6197903bd42478987516bc4cc3f0769488a37065.zip
Adding upstream version 2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/nvme_dsm_test.py')
-rw-r--r--tests/nvme_dsm_test.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/nvme_dsm_test.py b/tests/nvme_dsm_test.py
new file mode 100644
index 0000000..fe3dc01
--- /dev/null
+++ b/tests/nvme_dsm_test.py
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This file is part of nvme-cli
+#
+# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+# Author: Arunpandian J <apj.arun@samsung.com>
+
+"""
+NVMe DSM Testcase:-
+
+ 1. Issue DSM command on set of block; shall pass.
+
+"""
+
+from nose.tools import assert_equal
+from nvme_test import TestNVMe
+
+
+class TestNVMeDsm(TestNVMe):
+
+ """
+ Represents NVMe Verify testcase.
+ - Attributes:
+ - start_block : starting block of to verify operation.
+ - range : Range of blocks for DSM operation.
+ - test_log_dir : directory for logs, temp files.
+ """
+
+ def __init__(self):
+ """ Pre Section for TestNVMeDsm """
+ TestNVMe.__init__(self)
+ self.start_block = 0
+ self.range = 0
+ self.namespace = 1
+ self.setup_log_dir(self.__class__.__name__)
+
+ def __del__(self):
+ """ Post Section for TestNVMeDsm """
+ TestNVMe.__del__(self)
+
+ def dsm(self):
+ """ Wrapper for nvme verify
+ - Args:
+ - None
+ - Returns:
+ - return code for nvme dsm command.
+ """
+ dsm_cmd = "nvme dsm " + self.ctrl + \
+ " --namespace-id=" + str(self.namespace) + \
+ " --blocks=" + str(self.range) + \
+ " --slbs=" + str(self.start_block)
+ return self.exec_cmd(dsm_cmd)
+
+ def test_dsm(self):
+ """ Testcase main """
+ assert_equal(self.dsm(), 0)