1818
1919import base64
2020
21- from nvme_test import TestNVMe
21+ from nvme_test import TestNVMe , to_decimal
2222
2323
2424class TestNVMeCopy (TestNVMe ):
@@ -35,6 +35,9 @@ def setUp(self):
3535 """ Pre Section for TestNVMeCopy """
3636 super ().setUp ()
3737 self .ocfs = self .get_ocfs ()
38+ self .mcl = to_decimal (self .get_id_ns_field_value ("mcl" ))
39+ self .mssrl = to_decimal (self .get_id_ns_field_value ("mssrl" ))
40+ self .msrc = to_decimal (self .get_id_ns_field_value ("msrc" ))
3841 self .host_behavior_data = None
3942 cross_namespace_copy = self .ocfs & 0xc
4043 if cross_namespace_copy :
@@ -78,6 +81,14 @@ def _check_format_supported(self, desc_format):
7881 if not self .ocfs & (1 << desc_format ):
7982 self .skipTest (f"descriptor format { desc_format } is not supported" )
8083
84+ def _check_ns_copy_limits (self ):
85+ """ Skip test if namespace copy limits (mcl, mssrl, msrc) are not set """
86+ missing = [name for name , val in
87+ [("mcl" , self .mcl ), ("mssrl" , self .mssrl ), ("msrc" , self .msrc )]
88+ if val == 0 ]
89+ if missing :
90+ self .skipTest (f"{ ', ' .join (missing )} are 0, copy not supported on this namespace" )
91+
8192 def copy (self , sdlba , blocks , slbs , ** kwargs ):
8293 """ Wrapper for nvme copy
8394 - Args:
@@ -105,29 +116,35 @@ def copy(self, sdlba, blocks, slbs, **kwargs):
105116 def test_copy_format_0 (self ):
106117 """ Test copy with descriptor format 0 """
107118 self ._check_format_supported (0 )
119+ self ._check_ns_copy_limits ()
108120 self .copy (0 , 1 , 2 , descriptor_format = 0 )
109121
110122 def test_copy_format_1 (self ):
111123 """ Test copy with descriptor format 1 """
112124 self ._check_format_supported (1 )
125+ self ._check_ns_copy_limits ()
113126 self .copy (0 , 1 , 2 , descriptor_format = 1 )
114127
115128 def test_copy_format_2 (self ):
116129 """ Test copy with descriptor format 2 """
117130 self ._check_format_supported (2 )
131+ self ._check_ns_copy_limits ()
118132 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid )
119133
120134 def test_copy_format_2_sopts (self ):
121135 """ Test copy with descriptor format 2 and source options """
122136 self ._check_format_supported (2 )
137+ self ._check_ns_copy_limits ()
123138 self .copy (0 , 1 , 2 , descriptor_format = 2 , snsids = self .ns1_nsid , sopts = 0 )
124139
125140 def test_copy_format_3 (self ):
126141 """ Test copy with descriptor format 3 """
127142 self ._check_format_supported (3 )
143+ self ._check_ns_copy_limits ()
128144 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid )
129145
130146 def test_copy_format_3_sopts (self ):
131147 """ Test copy with descriptor format 3 and source options """
132148 self ._check_format_supported (3 )
149+ self ._check_ns_copy_limits ()
133150 self .copy (0 , 1 , 2 , descriptor_format = 3 , snsids = self .ns1_nsid , sopts = 0 )
0 commit comments