@@ -76,6 +76,11 @@ def tearDown(self):
7676 self .run_cmd (set_features_cmd )
7777 super ().tearDown ()
7878
79+ def _check_format_supported (self , desc_format ):
80+ """ Skip test if the given copy descriptor format is not supported """
81+ if not self .ocfs & (1 << desc_format ):
82+ self .skipTest (f"descriptor format { desc_format } is not supported" )
83+
7984 def copy (self , sdlba , blocks , slbs , ** kwargs ):
8085 """ Wrapper for nvme copy
8186 - Args:
@@ -88,11 +93,7 @@ def copy(self, sdlba, blocks, slbs, **kwargs):
8893 - Returns:
8994 - None
9095 """
91- # skip if descriptor format not supported (default format is 0)
9296 desc_format = kwargs .get ("descriptor_format" , 0 )
93- if not self .ocfs & (1 << desc_format ):
94- print (f"Skip copy because descriptor format { desc_format } is not supported" )
95- return
9697 # build copy command
9798 copy_cmd = f"{ self .nvme_bin } copy { self .ns1 } " + \
9899 f"--format={ desc_format } --sdlba={ sdlba } --blocks={ blocks } " + \
@@ -104,11 +105,32 @@ def copy(self, sdlba, blocks, slbs, **kwargs):
104105 # run and assert success
105106 self .assertEqual (self .exec_cmd (copy_cmd ), 0 )
106107
107- def test_copy (self ):
108- """ Testcase main """
108+ def test_copy_format_0 (self ):
109+ """ Test copy with descriptor format 0 """
110+ self ._check_format_supported (0 )
109111 self .copy (0 , 1 , 2 , descriptor_format = 0 )
112+
113+ def test_copy_format_1 (self ):
114+ """ Test copy with descriptor format 1 """
115+ self ._check_format_supported (1 )
110116 self .copy (0 , 1 , 2 , descriptor_format = 1 )
117+
118+ def test_copy_format_2 (self ):
119+ """ Test copy with descriptor format 2 """
120+ self ._check_format_supported (2 )
111121 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid )
122+
123+ def test_copy_format_2_sopts (self ):
124+ """ Test copy with descriptor format 2 and source options """
125+ self ._check_format_supported (2 )
112126 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid , sopts = 0 )
127+
128+ def test_copy_format_3 (self ):
129+ """ Test copy with descriptor format 3 """
130+ self ._check_format_supported (3 )
113131 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid )
132+
133+ def test_copy_format_3_sopts (self ):
134+ """ Test copy with descriptor format 3 and source options """
135+ self ._check_format_supported (3 )
114136 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid , sopts = 0 )
0 commit comments