]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
tests: Fix nvme_smart_log_test
authorDennis Maisenbacher <dennis.maisenbacher@wdc.com>
Thu, 17 Oct 2024 08:41:08 +0000 (08:41 +0000)
committerDaniel Wagner <wagi@monom.org>
Tue, 29 Oct 2024 06:37:41 +0000 (07:37 +0100)
Don't parse the smart log output to then print the (unsuccessfuly) parsed
values. Instead we print out the whole smart log output.

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

index 916ef49a5a6e2d4b45858b7691f836915c96a658..196998b8605b7901d6adda3802a36522ead041a3 100644 (file)
@@ -85,5 +85,5 @@ class TestNVMeSmartLogCmd(TestNVMe):
         """ Testcase main """
         self.assertEqual(self.get_smart_log_ctrl(), 0)
         smlp = self.supp_check_id_ctrl("lpa")
-        if smlp & 0x1 == True:
+        if smlp & 0x1:
             self.assertEqual(self.get_smart_log_all_ns(), 0)
index cf2f9370c4dfc02f6bce1950274cd28e887cdb34..ba62add24ba3935f2cedb5040819a488bd3efe4a 100644 (file)
@@ -435,25 +435,8 @@ class TestNVMe(unittest.TestCase):
                                 encoding='utf-8')
         err = proc.wait()
         self.assertEqual(err, 0, "ERROR : nvme smart log failed")
-
-        for line in proc.stdout:
-            if "data_units_read" in line:
-                data_units_read = \
-                    line.replace(",", "", 1)
-            if "data_units_written" in line:
-                data_units_written = \
-                    line.replace(",", "", 1)
-            if "host_read_commands" in line:
-                host_read_commands = \
-                    line.replace(",", "", 1)
-            if "host_write_commands" in line:
-                host_write_commands = \
-                    line.replace(",", "", 1)
-
-        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)
+        smart_log_output = proc.communicate()[0]
+        print(f"{smart_log_output}")
         return err
 
     def get_id_ctrl(self, vendor=False):