]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
tests: Update print to print() for python3
authorMinwoo Im <minwoo.im.dev@gmail.com>
Sun, 7 Apr 2019 11:24:55 +0000 (20:24 +0900)
committerMinwoo Im <minwoo.im.dev@gmail.com>
Sun, 7 Apr 2019 11:24:55 +0000 (20:24 +0900)
The following issue has been reported that README in "tests" seems not
correct because it will not be able to be invoked in case python3
because print() has to be taken instead of print which had been used for
python2.

Issue !429:
  https://github.com/linux-nvme/nvme-cli/issues/429

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
tests/nvme_create_max_ns_test.py
tests/nvme_flush_test.py
tests/nvme_format_test.py
tests/nvme_fw_log_test.py
tests/nvme_get_features_test.py
tests/nvme_id_ns_test.py
tests/nvme_test.py
tests/nvme_test_io.py

index e097e59ad0b1fda66c2c8502e20ffd8885ec7d5e..f853732157eedc48e74f9c76ebbe08705f1966f4 100644 (file)
@@ -77,21 +77,21 @@ class TestNVMeCreateMaxNS(TestNVMe):
     def test_attach_detach_ns(self):
         """ Testcase main """
         for nsid in range(1, self.max_ns):
-            print "##### Creating " + str(nsid)
+            print("##### Creating " + str(nsid))
             err = self.create_and_validate_ns(nsid,
                                               self.nsze,
                                               self.ncap,
                                               self.flbas,
                                               self.dps)
             assert_equal(err, 0)
-            print "##### Attaching " + str(nsid)
+            print("##### Attaching " + str(nsid))
             assert_equal(self.attach_ns(self.ctrl_id, nsid), 0)
-            print "##### Running IOs in " + str(nsid)
+            print("##### Running IOs in " + str(nsid))
             self.run_ns_io(nsid, 0)
 
         for nsid in range(1, self.max_ns):
-            print "##### Detaching " + str(nsid)
+            print("##### Detaching " + str(nsid))
             assert_equal(self.detach_ns(self.ctrl_id, nsid), 0)
-            print "#### Deleting " + str(nsid)
+            print("#### Deleting " + str(nsid))
             assert_equal(self.delete_and_validate_ns(nsid), 0)
         self.nvme_reset_ctrl()
index d080887df467e19c00aedb1a0ab1836d6bf38343..f3a68b316d8ac0271b55b4ba44114b95c4733824 100644 (file)
@@ -53,7 +53,7 @@ class TestNVMeFlushCmd(TestNVMe):
                - None
         """
         flush_cmd = "nvme flush " + self.ctrl + " -n " + str(self.default_nsid)
-        print flush_cmd
+        print(flush_cmd)
         return self.exec_cmd(flush_cmd)
 
     def test_nvme_flush(self):
index e5da23fde05f4d6f83196cda96b8e6aa6a150a8e..ce93f5ec2d89d0d28c2c9a46162d354677780fa8 100644 (file)
@@ -127,9 +127,9 @@ class TestNVMeFormatCmd(TestNVMe):
 
         # iterate through all supported format
         for i in range(0, len(self.lba_format_list)):
-            print "\nlba format " + str(self.lba_format_list[i]) + \
+            print("\nlba format " + str(self.lba_format_list[i]) + \
                   " lbad       " + str(self.lbads_list[i]) + \
-                  " ms         " + str(self.ms_list[i])
+                  " ms         " + str(self.ms_list[i]))
             metadata_size = 1 if self.ms_list[i] == '8' else 0
             err = self.create_and_validate_ns(self.default_nsid,
                                               self.nsze,
index cf01307214bfddd33a00e6fa29597da0c34efb3a..dc8a150620bff8f81182c7cf01c7f230673acccf 100644 (file)
@@ -61,7 +61,7 @@ class TestNVMeFwLogCmd(TestNVMe):
                                 shell=True,
                                 stdout=subprocess.PIPE)
         fw_log_output = proc.communicate()[0]
-        print fw_log_output + "\n"
+        print(fw_log_output + "\n")
         err = proc.wait()
         return err
 
index 554aebe56596e0deae39ea6ac42ed0c779270adf..8888e4a930d7c7b3101fb6c0a5dbb1cfaa1528b7 100644 (file)
@@ -85,7 +85,7 @@ class TestNVMeGetMandatoryFeatures(TestNVMe):
                                         shell=True,
                                         stdout=subprocess.PIPE)
                 feature_output = proc.communicate()[0]
-                print feature_output
+                print(feature_output)
                 assert_equal(proc.wait(), 0)
         else:
             get_feat_cmd = "nvme get-feature " + self.ctrl + \
@@ -94,7 +94,7 @@ class TestNVMeGetMandatoryFeatures(TestNVMe):
                                     shell=True,
                                     stdout=subprocess.PIPE)
             feature_output = proc.communicate()[0]
-            print feature_output
+            print(feature_output)
             assert_equal(proc.wait(), 0)
 
     def test_get_mandatory_features(self):
index 1cfd396483a9342d4353564cd20f6e6eeb53c310..cd30c31e816e4e68453f6fae8e21b64ad1b8d15c 100644 (file)
@@ -64,7 +64,7 @@ class TestNVMeIdentifyNamespace(TestNVMe):
                                 shell=True,
                                 stdout=subprocess.PIPE)
         id_ns_output = proc.communicate()[0]
-        print id_ns_output + "\n"
+        print(id_ns_output + "\n")
         err = proc.wait()
         return err
 
index c67b60d88ce98ee6ffd135e47873f3eb21c77140..80939dc78d42de8ba7839f9a708a883f5f26da57 100644 (file)
@@ -202,7 +202,7 @@ class TestNVMe(object):
             if pattern.match(line):
                 max_ns = line.split(":")[1].strip()
                 break
-        print max_ns
+        print(max_ns)
         return int(max_ns)
 
     @tools.nottest
@@ -226,7 +226,7 @@ class TestNVMe(object):
             if pattern.match(line):
                 ncap = line.split(":")[1].strip()
                 break
-        print ncap
+        print(ncap)
         return int(ncap)
 
     @tools.nottest
@@ -249,7 +249,7 @@ class TestNVMe(object):
         for line in proc.stdout:
             if "in use" in line:
                 nvm_format = 2 ** int(line.split(":")[3].split()[0])
-        print nvm_format
+        print(nvm_format)
         return int(nvm_format)
 
     @tools.nottest
@@ -370,7 +370,7 @@ class TestNVMe(object):
                 - 0 on success, error code on failure.
         """
         smart_log_cmd = "nvme smart-log " + self.ctrl + " -n " + str(nsid)
-        print smart_log_cmd
+        print(smart_log_cmd)
         proc = subprocess.Popen(smart_log_cmd,
                                 shell=True,
                                 stdout=subprocess.PIPE)
@@ -391,10 +391,10 @@ class TestNVMe(object):
                 host_write_commands = \
                     string.replace(line.split(":")[1].strip(), ",", "")
 
-        print "data_units_read " + data_units_read
-        print "data_units_written " + data_units_written
-        print "host_read_commands " + host_read_commands
-        print "host_write_commands " + host_write_commands
+        print("data_units_read " + data_units_read)
+        print("data_units_written " + data_units_written)
+        print("host_read_commands " + host_read_commands)
+        print("host_write_commands " + host_write_commands)
         return err
 
     def get_id_ctrl(self, vendor=False):
@@ -408,7 +408,7 @@ class TestNVMe(object):
             id_ctrl_cmd = "nvme id-ctrl " + self.ctrl
         else:
             id_ctrl_cmd = "nvme id-ctrl -v " + self.ctrl
-        print id_ctrl_cmd
+        print(id_ctrl_cmd)
         proc = subprocess.Popen(id_ctrl_cmd,
                                 shell=True,
                                 stdout=subprocess.PIPE)
@@ -450,13 +450,13 @@ class TestNVMe(object):
         ns_path = self.ctrl + "n" + str(nsid)
         io_cmd = "dd if=" + ns_path + " of=/dev/null" + " bs=" + \
                  str(block_size) + " count=10 > /dev/null 2>&1"
-        print io_cmd
+        print(io_cmd)
         run_io = subprocess.Popen(io_cmd, shell=True, stdout=subprocess.PIPE)
         run_io_result = run_io.communicate()[1]
         assert_equal(run_io_result, None)
         io_cmd = "dd if=/dev/zero of=" + ns_path + " bs=" + \
                  str(block_size) + " count=10 > /dev/null 2>&1"
-        print io_cmd
+        print(io_cmd)
         run_io = subprocess.Popen(io_cmd, shell=True, stdout=subprocess.PIPE)
         run_io_result = run_io.communicate()[1]
         assert_equal(run_io_result, None)
index e2a6b46fafb93b9d5b8ef1286499d41a031e0d31..0c5c6bbdb478f8d601a7da63a9ba87d10359cc9f 100644 (file)
@@ -95,5 +95,5 @@ class TestNVMeIO(TestNVMe):
                    str(self.start_block) + " --block-count=" + \
                    str(self.block_count) + " --data-size=" + \
                    str(self.data_size) + " --data=" + self.read_file
-        print read_cmd
+        print(read_cmd)
         return self.exec_cmd(read_cmd)