All of lore.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
Subject: [nvme-cli 4/9] tests: ignore log tests for Qemu
Date: Tue, 30 Apr 2019 08:05:49 +0200	[thread overview]
Message-ID: <20190430060554.24368-5-hare@suse.de> (raw)
In-Reply-To: <20190430060554.24368-1-hare@suse.de>

The Qemu NVMe implementation doesn't support the GET LOG command,
so these tests are expected to fail.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 tests/nvme_error_log_test.py |  3 ++-
 tests/nvme_smart_log_test.py |  5 +++--
 tests/nvme_test.py           | 24 ++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/tests/nvme_error_log_test.py b/tests/nvme_error_log_test.py
index a6a451d..68a0b1f 100644
--- a/tests/nvme_error_log_test.py
+++ b/tests/nvme_error_log_test.py
@@ -60,4 +60,5 @@ class TestNVMeErrorLogCmd(TestNVMe):
 
     def test_get_error_log(self):
         """ Testcase main """
-        assert_equal(self.get_error_log_ctrl(), 0)
+        if self.is_qemu_controller() == 0:
+            assert_equal(self.get_error_log_ctrl(), 0)
diff --git a/tests/nvme_smart_log_test.py b/tests/nvme_smart_log_test.py
index e1eb6e5..ddfac72 100644
--- a/tests/nvme_smart_log_test.py
+++ b/tests/nvme_smart_log_test.py
@@ -82,5 +82,6 @@ class TestNVMeSmartLogCmd(TestNVMe):
 
     def test_smart_log(self):
         """ Testcase main """
-        assert_equal(self.get_smart_log_ctrl(), 0)
-        assert_equal(self.get_smart_log_all_ns(), 0)
+        if self.is_qemu_controller() == 0:
+            assert_equal(self.get_smart_log_ctrl(), 0)
+            assert_equal(self.get_smart_log_all_ns(), 0)
diff --git a/tests/nvme_test.py b/tests/nvme_test.py
index 7fa0734..538d30c 100644
--- a/tests/nvme_test.py
+++ b/tests/nvme_test.py
@@ -324,6 +324,30 @@ class TestNVMe(object):
         return int(oncs, 16) & 1
 
     @tools.nottest
+    def is_qemu_controller(self):
+        """ Wrapper for checking for Qemu NVMe controller.
+            - Args:
+                - None
+            - Returns:
+                - true if supported.
+        """
+        pattern = re.compile("^mn[ ]+: [a-z ]", re.IGNORECASE)
+        model = ""
+        get_ctrl_id = "nvme id-ctrl " + self.ctrl
+        proc = subprocess.Popen(get_ctrl_id,
+                                shell=True,
+                                stdout=subprocess.PIPE)
+        err = proc.wait()
+        assert_equal(err, 0, "ERROR : reading controller model value failed")
+
+        for line in proc.stdout:
+            if pattern.match(line):
+                model = line.split(":")[1].strip()
+                break
+
+        return model in "QEMU NVMe Ctrl"
+
+    @tools.nottest
     def delete_all_ns(self):
         """ Wrapper for deleting all the namespaces.
             - Args:
-- 
2.13.7

  parent reply	other threads:[~2019-04-30  6:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30  6:05 [nvme-cli 0/9] Update tests for qemu Hannes Reinecke
2019-04-30  6:05 ` [nvme-cli 1/9] tests/nvme_writezeros_test.py: check if write zeroes is supported Hannes Reinecke
2019-04-30 16:48   ` Heitke, Kenneth
2019-04-30  6:05 ` [nvme-cli 2/9] tests/nvme_writeuncor_test.py: check if write uncorrectable " Hannes Reinecke
2019-04-30 18:56   ` Heitke, Kenneth
2019-04-30  6:05 ` [nvme-cli 3/9] tests/nvme_compare_test.py: check if compare " Hannes Reinecke
2019-04-30  6:05 ` Hannes Reinecke [this message]
2019-04-30  6:05 ` [nvme-cli 5/9] tests/nvme_text.py: add test for namespace management Hannes Reinecke
2019-04-30  6:05 ` [nvme-cli 6/9] tests/nvme_attach_detach_ns_test.py: skip if namespace mgmt is not supported Hannes Reinecke
2019-04-30  6:05 ` [nvme-cli 7/9] tests/nvme_create_max_ns_test.py: " Hannes Reinecke
2019-04-30  6:05 ` [nvme-cli 8/9] tests/nvme_get_features_test.py: skip features for Qemu Hannes Reinecke
2019-04-30  6:05 ` [nvme-cli 9/9] tests/nvme_format_test.py: skip test if namespace management is not supported Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190430060554.24368-5-hare@suse.de \
    --to=hare@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.