From bdd1874f172438453c80f6b1cfcbd7ebbc31f02b Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 3 Feb 2020 16:08:40 +0100 Subject: tests,keyfiles: add dummy test to avoid -Wunused-function warnings If none of the plugins enabled in the build has custom keyfiles, the common_test() method would be unused. Avoid this just by adding a new dummy test which is always available in the keyfiles tester. --- plugins/tests/test-keyfiles.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/tests/test-keyfiles.c') diff --git a/plugins/tests/test-keyfiles.c b/plugins/tests/test-keyfiles.c index 89ecbb30..35ec4b46 100644 --- a/plugins/tests/test-keyfiles.c +++ b/plugins/tests/test-keyfiles.c @@ -34,6 +34,9 @@ common_test (const gchar *keyfile_path) GError *error = NULL; gboolean ret; + if (!keyfile_path) + return; + keyfile = g_key_file_new (); ret = g_key_file_load_from_file (keyfile, keyfile_path, G_KEY_FILE_NONE, &error); g_assert_no_error (error); @@ -41,6 +44,14 @@ common_test (const gchar *keyfile_path) g_key_file_unref (keyfile); } +/* Dummy test to avoid compiler warning about common_test() being unused + * when none of the plugins enabled in build have custom key files. */ +static void +test_dummy (void) +{ + common_test (NULL); +} + /************************************************************/ #if defined ENABLE_PLUGIN_FOXCONN @@ -78,6 +89,7 @@ int main (int argc, char **argv) setlocale (LC_ALL, ""); g_test_init (&argc, &argv, NULL); + g_test_add_func ("/MM/test-keyfiles/dummy", test_dummy); #if defined ENABLE_PLUGIN_FOXCONN g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968); -- cgit v1.2.3-70-g09d2