summaryrefslogtreecommitdiffstats
path: root/tests/nvme_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 18:28:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-16 15:12:07 +0000
commit589986012c4b3ab68e299a2eadca18f90080113b (patch)
treef29a53b04a1950cdddae69344bccb3f0146fa728 /tests/nvme_test.py
parentReleasing debian version 1.16-4. (diff)
downloadnvme-cli-589986012c4b3ab68e299a2eadca18f90080113b.tar.xz
nvme-cli-589986012c4b3ab68e299a2eadca18f90080113b.zip
Merging upstream version 2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/nvme_test.py')
-rw-r--r--tests/nvme_test.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/tests/nvme_test.py b/tests/nvme_test.py
index b49c12f..11c89fe 100644
--- a/tests/nvme_test.py
+++ b/tests/nvme_test.py
@@ -20,15 +20,16 @@
""" Base class for all the testcases
"""
-import re
-import os
-import sys
import json
import mmap
-import stat
-import time
+import os
+import re
import shutil
+import stat
import subprocess
+import sys
+import time
+
from nose import tools
from nose.tools import assert_equal
from nvme_test_logger import TestNVMeLogger
@@ -477,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)