]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: tests: Add get_id_ctrl function
authorDong Ho <Dong.Ho@wdc.com>
Fri, 21 Sep 2018 18:10:39 +0000 (18:10 +0000)
committerKeith Busch <keith.busch@intel.com>
Fri, 21 Sep 2018 19:21:35 +0000 (13:21 -0600)
Signed-off-by: Dong Ho <dong.ho@wdc.com>
tests/nvme_test.py

index 94406b54a586cfbcebe2c1a5ed16827ab7de8a72..d735863d1eb3ae9b96770cc29be78d4c7f5202d5 100644 (file)
@@ -396,6 +396,25 @@ class TestNVMe(object):
         print "host_write_commands " + host_write_commands
         return err
 
+    def get_id_ctrl(self, vendor=False):
+        """ Wrapper for nvme id-ctrl command.
+            - Args:
+              - None
+            - Returns:
+              - 0 on success, error code on failure.
+        """
+        if not vendor:
+            id_ctrl_cmd = "nvme id-ctrl " + self.ctrl
+        else:
+            id_ctrl_cmd = "nvme id-ctrl -v " + self.ctrl
+        print id_ctrl_cmd
+        proc = subprocess.Popen(id_ctrl_cmd,
+                                shell=True,
+                                stdout=subprocess.PIPE)
+        err = proc.wait()
+        assert_equal(err, 0, "ERROR : nvme id controller failed")
+        return err
+
     def get_error_log(self):
         """ Wrapper for nvme error-log command.
             - Args: