@@ -80,6 +80,11 @@ def tearDown(self):
8080 self .run_cmd (set_features_cmd )
8181 super ().tearDown ()
8282
83+ def _check_format_supported (self , desc_format ):
84+ """ Skip test if the given copy descriptor format is not supported """
85+ if not self .ocfs & (1 << desc_format ):
86+ self .skipTest (f"descriptor format { desc_format } is not supported" )
87+
8388 def copy (self , sdlba , blocks , slbs , ** kwargs ):
8489 """ Wrapper for nvme copy
8590 - Args:
@@ -92,11 +97,7 @@ def copy(self, sdlba, blocks, slbs, **kwargs):
9297 - Returns:
9398 - None
9499 """
95- # skip if descriptor format not supported (default format is 0)
96100 desc_format = kwargs .get ("descriptor_format" , 0 )
97- if not self .ocfs & (1 << desc_format ):
98- print (f"Skip copy because descriptor format { desc_format } is not supported" )
99- return
100101 # build copy command
101102 copy_cmd = f"{ self .nvme_bin } copy { self .ns1 } " + \
102103 f"--format={ desc_format } --sdlba={ sdlba } --blocks={ blocks } " + \
@@ -108,11 +109,32 @@ def copy(self, sdlba, blocks, slbs, **kwargs):
108109 # run and assert success
109110 self .assertEqual (self .exec_cmd (copy_cmd ), 0 )
110111
111- def test_copy (self ):
112- """ Testcase main """
112+ def test_copy_format_0 (self ):
113+ """ Test copy with descriptor format 0 """
114+ self ._check_format_supported (0 )
113115 self .copy (0 , 1 , 2 , descriptor_format = 0 )
116+
117+ def test_copy_format_1 (self ):
118+ """ Test copy with descriptor format 1 """
119+ self ._check_format_supported (1 )
114120 self .copy (0 , 1 , 2 , descriptor_format = 1 )
121+
122+ def test_copy_format_2 (self ):
123+ """ Test copy with descriptor format 2 """
124+ self ._check_format_supported (2 )
115125 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid )
126+
127+ def test_copy_format_2_sopts (self ):
128+ """ Test copy with descriptor format 2 and source options """
129+ self ._check_format_supported (2 )
116130 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid , sopts = 0 )
131+
132+ def test_copy_format_3 (self ):
133+ """ Test copy with descriptor format 3 """
134+ self ._check_format_supported (3 )
117135 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid )
136+
137+ def test_copy_format_3_sopts (self ):
138+ """ Test copy with descriptor format 3 and source options """
139+ self ._check_format_supported (3 )
118140 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid , sopts = 0 )
0 commit comments