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.
This commit is contained in:
Aleksander Morgado
2020-02-03 16:08:40 +01:00
parent 55d344ab96
commit bdd1874f17

View File

@@ -34,6 +34,9 @@ common_test (const gchar *keyfile_path)
GError *error = NULL; GError *error = NULL;
gboolean ret; gboolean ret;
if (!keyfile_path)
return;
keyfile = g_key_file_new (); keyfile = g_key_file_new ();
ret = g_key_file_load_from_file (keyfile, keyfile_path, G_KEY_FILE_NONE, &error); ret = g_key_file_load_from_file (keyfile, keyfile_path, G_KEY_FILE_NONE, &error);
g_assert_no_error (error); g_assert_no_error (error);
@@ -41,6 +44,14 @@ common_test (const gchar *keyfile_path)
g_key_file_unref (keyfile); 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 #if defined ENABLE_PLUGIN_FOXCONN
@@ -78,6 +89,7 @@ int main (int argc, char **argv)
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_add_func ("/MM/test-keyfiles/dummy", test_dummy);
#if defined ENABLE_PLUGIN_FOXCONN #if defined ENABLE_PLUGIN_FOXCONN
g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968); g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968);