multipath/tests: fix hwtable tests after "hidden" support
authorMartin Wilck <mwilck@suse.com>
Tue, 2 Oct 2018 18:47:00 +0000 (20:47 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 7 Oct 2018 07:58:59 +0000 (09:58 +0200)
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
tests/test-lib.h

index cff7a5d..5927516 100644 (file)
@@ -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) {
index d274597..7643ab6 100644 (file)
@@ -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 {