]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
tests: check if verify command is supported
authorDennis Maisenbacher <dennis.maisenbacher@wdc.com>
Thu, 13 Feb 2025 13:56:36 +0000 (13:56 +0000)
committerDaniel Wagner <wagi@monom.org>
Fri, 14 Feb 2025 17:08:49 +0000 (18:08 +0100)
Check if the optional NVM command 'verify' (NVMCPYS) is supported before
running tests for this command.

Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
tests/nvme_verify_test.py

index 44c8942bff8a883203719a9b2202137c1e366f50..90e149dc78e7ff60dde2bca4dc7595630799e291 100644 (file)
@@ -13,7 +13,7 @@ NVMe Verify Testcase:-
 
 """
 
-from nvme_test import TestNVMe
+from nvme_test import TestNVMe, to_decimal
 
 
 class TestNVMeVerify(TestNVMe):
@@ -25,9 +25,21 @@ class TestNVMeVerify(TestNVMe):
               - test_log_dir : directory for logs, temp files.
     """
 
+    def verify_cmd_supported(self):
+        """ Wrapper for extracting optional NVM 'verify' command support
+            - Args:
+                - None
+            - Returns:
+                - True if 'verify' is supported, otherwise False
+        """
+        return to_decimal(self.get_id_ctrl_field_value("oncs")) & (1 << 7)
+
     def setUp(self):
         """ Pre Section for TestNVMeVerify """
         super().setUp()
+        if not self.verify_cmd_supported():
+            self.skipTest(
+                "because: Optional NVM Command 'Verify' (NVMVFYS) not supported")
         self.start_block = 0
         self.block_count = 0
         self.namespace = 1