[dm-devel] [PATCH 1/2] multipath/tests: fix hwtable tests after "hidden" support

Martin Wilck mwilck at suse.com
Tue Oct 2 18:47:00 UTC 2018


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




More information about the dm-devel mailing list