From: Arunpandian J Date: Fri, 25 Mar 2022 03:23:54 +0000 (+0530) Subject: nvme_test: Add supp_check_id_ctrl wrapper for support check X-Git-Tag: v2.0-rc8~17^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3169df649a4a62e076a2ab92b58ffe9c0fac22d8;p=users%2Fsagi%2Fnvme-cli.git nvme_test: Add supp_check_id_ctrl wrapper for support check added supp_check_id_ctrl wrapper to check support based on passed key value to make it generic. Signed-off-by: Arunpandian J --- diff --git a/tests/nvme_test.py b/tests/nvme_test.py index 5a5971ee..11c89fe4 100644 --- a/tests/nvme_test.py +++ b/tests/nvme_test.py @@ -478,3 +478,26 @@ class TestNVMe(object): encoding='utf-8') run_io_result = run_io.communicate()[1] assert_equal(run_io_result, None) + + def supp_check_id_ctrl(self, key): + """ Wrapper for support check. + - Args: + - key : search key. + - Returns: + - value for key requested. + """ + id_ctrl = "nvme id-ctrl " + self.ctrl + print("\n" + id_ctrl) + proc = subprocess.Popen(id_ctrl, + shell=True, + stdout=subprocess.PIPE, + encoding='utf-8') + err = proc.wait() + assert_equal(err, 0, "ERROR : nvme Identify controller Data \ + structure failed") + for line in proc.stdout: + if key in line: + key = line.replace(",", "", 1) + print(key) + val = (key.split(':'))[1].strip() + return int(val, 16)