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 1/2] multipath/tests: fix hwtable tests after "hidden" support
Date: Tue,  2 Oct 2018 20:47:00 +0200	[thread overview]
Message-ID: <20181002184701.18956-2-mwilck@suse.com> (raw)
In-Reply-To: <20181002184701.18956-1-mwilck@suse.com>

The previous patch "libmultipath: pathinfo: skip hidden devices"
requires a change in the pathinfo mocking code. Otherwise the hwtable
tests will fail.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/test-lib.c | 6 ++++++
 tests/test-lib.h | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/test-lib.c b/tests/test-lib.c
index cff7a5d1..59275163 100644
--- a/tests/test-lib.c
+++ b/tests/test-lib.c
@@ -248,6 +248,12 @@ static void mock_sysfs_pathinfo(const struct mocked_path *mp)
  */
 void mock_pathinfo(int mask, const struct mocked_path *mp)
 {
+	if (mp->flags & DEV_HIDDEN) {
+		will_return(__wrap_udev_device_get_sysattr_value, "1");
+		return;
+	} else
+		will_return(__wrap_udev_device_get_sysattr_value, "0");
+
 	/* filter_property */
 	will_return(__wrap_udev_device_get_sysname, mp->devnode);
 	if (mp->flags & BL_BY_PROPERTY) {
diff --git a/tests/test-lib.h b/tests/test-lib.h
index d2745979..7643ab67 100644
--- a/tests/test-lib.h
+++ b/tests/test-lib.h
@@ -14,7 +14,8 @@ enum {
 	BL_MASK = BL_BY_DEVNODE|BL_BY_DEVICE|BL_BY_WWID|BL_BY_PROPERTY,
 	NEED_SELECT_PRIO = (1 << 8),
 	NEED_FD		= (1 << 9),
-	USE_GETUID	= (1 << 10)
+	USE_GETUID	= (1 << 10),
+	DEV_HIDDEN	= (1 << 11),
 };
 
 struct mocked_path {
-- 
2.19.0

  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 ` Martin Wilck [this message]
2018-10-02 18:47 ` [PATCH 2/2] multipath-tools: tests/hwtable: test hidden devices Martin Wilck

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-2-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