From 55d344ab963703ac91fb09e7e985395887a08dd6 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sun, 2 Feb 2020 11:33:13 +0100 Subject: [PATCH] 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. --- plugins/tests/test-udev-rules.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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);