diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-02-02 11:33:13 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-02-02 11:33:13 +0100 |
commit | 55d344ab963703ac91fb09e7e985395887a08dd6 (patch) | |
tree | ab46843345d0663cfd3c9756623337434e445bed | |
parent | a8fd33ebaa80a0844c375fdb39173736d18f71cb (diff) |
tests,udev-rules: add dummy test to avoid -Wunused-function warnings
If none of the plugins enabled in the build has custom udev rules, the
common_test() method would be unused. Avoid this just by adding a new
dummy test which is always available in the udev rules tester.
-rw-r--r-- | plugins/tests/test-udev-rules.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/tests/test-udev-rules.c b/plugins/tests/test-udev-rules.c index adc7f374..83ba95ba 100644 --- a/plugins/tests/test-udev-rules.c +++ b/plugins/tests/test-udev-rules.c @@ -35,6 +35,9 @@ common_test (const gchar *plugindir) GArray *rules; GError *error = NULL; + if (!plugindir) + return; + rules = mm_kernel_device_generic_rules_load (plugindir, &error); g_assert_no_error (error); g_assert (rules); @@ -43,6 +46,14 @@ common_test (const gchar *plugindir) g_array_unref (rules); } +/* Dummy test to avoid compiler warning about common_test() being unused + * when none of the plugins enabled in build have custom udev rules. */ +static void +test_dummy (void) +{ + common_test (NULL); +} + /************************************************************/ #if defined ENABLE_PLUGIN_HUAWEI @@ -176,6 +187,7 @@ int main (int argc, char **argv) setlocale (LC_ALL, ""); g_test_init (&argc, &argv, NULL); + g_test_add_func ("/MM/test-udev-rules/dummy", test_dummy); #if defined ENABLE_PLUGIN_HUAWEI g_test_add_func ("/MM/test-udev-rules/huawei", test_huawei); |