diff mbox series

[1/2] multipath/tests: fix hwtable tests after "hidden" support

Message ID 20181002184701.18956-2-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: unit test fixes | expand

Commit Message

Martin Wilck Oct. 2, 2018, 6:47 p.m. UTC
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 mbox series

Patch

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 {