multipath-tools: tests/hwtable: test hidden devices
authorMartin Wilck <mwilck@suse.com>
Tue, 2 Oct 2018 18:47:01 +0000 (20:47 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 7 Oct 2018 07:59:01 +0000 (09:59 +0200)
Add a test for skipping "hidden" devices.

Signed-off-by: Martin Wilck <mwilck@suse.com>
tests/hwtable.c

index 42127ad..9146ecc 100644 (file)
@@ -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);