Linux Device Mapper development
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: Martin Wilck <mwilck@suse.com>, dm-devel@redhat.com
Subject: [PATCH 2/2] multipath-tools: tests/hwtable: test hidden devices
Date: Tue,  2 Oct 2018 20:47:01 +0200	[thread overview]
Message-ID: <20181002184701.18956-3-mwilck@suse.com> (raw)
In-Reply-To: <20181002184701.18956-1-mwilck@suse.com>

Add a test for skipping "hidden" devices.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/hwtable.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/hwtable.c b/tests/hwtable.c
index 42127adf..9146ecc3 100644
--- a/tests/hwtable.c
+++ b/tests/hwtable.c
@@ -1661,6 +1661,24 @@ static int setup_multipath_config_3(void **state)
 	return 0;
 }
 
+/*
+ * Test for device with "hidden" attribute
+ */
+static void test_hidden(const struct hwt_state *hwt)
+{
+	mock_path_flags("NVME", "NoName", DEV_HIDDEN|BL_MASK);
+}
+
+static int setup_hidden(void **state)
+{
+	struct hwt_state *hwt = CHECK_STATE(state);
+
+	WRITE_EMPTY_CONF(hwt);
+	SET_TEST_FUNC(hwt, test_hidden);
+
+	return 0;
+}
+
 /*
  * Create wrapper functions around test_driver() to avoid that cmocka
  * always uses the same test name. That makes it easier to read test results.
@@ -1703,6 +1721,7 @@ define_test(product_blacklist_matching)
 define_test(multipath_config)
 define_test(multipath_config_2)
 define_test(multipath_config_3)
+define_test(hidden)
 
 #define test_entry(x) \
 	cmocka_unit_test_setup(run_##x, setup_##x)
@@ -1742,6 +1761,7 @@ static int test_hwtable(void)
 		test_entry(multipath_config),
 		test_entry(multipath_config_2),
 		test_entry(multipath_config_3),
+		test_entry(hidden),
 	};
 
 	return cmocka_run_group_tests(tests, setup, teardown);
-- 
2.19.0

      parent reply	other threads:[~2018-10-02 18:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 18:46 [PATCH 0/2] multipath-tools: unit test fixes Martin Wilck
2018-10-02 18:47 ` [PATCH 1/2] multipath/tests: fix hwtable tests after "hidden" support Martin Wilck
2018-10-02 18:47 ` Martin Wilck [this message]

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=20181002184701.18956-3-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox