]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
tests: Adjust ncap and nsze for nvme_format_test
authorDennis Maisenbacher <dennis.maisenbacher@wdc.com>
Wed, 16 Oct 2024 12:56:12 +0000 (12:56 +0000)
committerDaniel Wagner <wagi@monom.org>
Tue, 29 Oct 2024 06:37:41 +0000 (07:37 +0100)
Set ncap and nsze to the lowest possible value, such that this test can
be run on different device capacities.

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

index 40635c155ef12d895bc6f595357254b5690ad9a0..12bc128f9aa8e3ed91304d558743e972812957e3 100644 (file)
@@ -37,6 +37,7 @@ Namespace Format testcase :-
            - Delete Namespace.
 """
 
+import math
 import subprocess
 import time
 
@@ -63,10 +64,14 @@ class TestNVMeFormatCmd(TestNVMe):
     def setUp(self):
         """ Pre Section for TestNVMeFormatCmd """
         super().setUp()
-        self.dps = 0                 # ns data protection settings
-        self.flbas = 0               # ns formattes logical block settings
-        self.nsze = 0x1400000        # ns size
-        self.ncap = 0x1400000        # ns capacity
+        self.dps = 0
+        self.flbas = 0
+        # Assuming run_ns_io with 4KiB * 10 writes.
+        # Calculating minimum required ncap for this workload
+        (ds, _) = self.get_lba_format_size()
+        ncap = int(math.ceil((4096*10)/ds))
+        self.ncap = ncap
+        self.nsze = ncap
         self.ctrl_id = self.get_ctrl_id()
         self.lba_format_list = []
         self.ms_list = []