gplugin/gplugin

bc4d270dc151
Merged in bugfix/valgrind-catchup (pull request #73)

Bugfix/valgrind catchup

Approved-by: Richard Laager
Approved-by: Elliott Sales de Andrade
--- a/gplugin/gplugin-file-tree.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-file-tree.c Fri Mar 20 04:44:34 2020 +0000
@@ -120,11 +120,16 @@
/* now run through all of the files and add then to the dir node */
while((filename = g_dir_read_name(dir)) != NULL) {
GNode *file = NULL;
+ gchar *test_filename = g_build_filename(path, filename, NULL);
- entry = gplugin_file_tree_entry_new(filename);
- file = g_node_new(entry);
+ if(g_file_test(test_filename, G_FILE_TEST_IS_REGULAR)) {
+ entry = gplugin_file_tree_entry_new(filename);
+ file = g_node_new(entry);
- g_node_prepend(node_dir, file);
+ g_node_prepend(node_dir, file);
+ }
+
+ g_free(test_filename);
}
/* close the dir */
--- a/gplugin/gplugin-loader-tests.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-loader-tests.c Fri Mar 20 04:44:34 2020 +0000
@@ -110,7 +110,10 @@
ret = gplugin_manager_load_plugin(plugin, &error);
g_assert_false(ret);
+
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
@@ -134,7 +137,10 @@
ret = gplugin_manager_load_plugin(plugin, &error);
g_assert_false(ret);
+
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
@@ -166,7 +172,10 @@
ret = gplugin_manager_unload_plugin(plugin, &error);
g_assert_false(ret);
+
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
+
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
--- a/gplugin/gplugin-manager.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-manager.c Fri Mar 20 04:44:34 2020 +0000
@@ -206,6 +206,36 @@
return NULL;
}
+static void
+gplugin_manager_foreach_unload_plugin(
+ gpointer key,
+ gpointer value,
+ G_GNUC_UNUSED gpointer data)
+{
+ GList *l = NULL;
+ gchar *id = (gchar *)key;
+
+ for(l = (GList *)value; l; l = l->next) {
+ GPluginPlugin *plugin = GPLUGIN_PLUGIN(l->data);
+ GPluginLoader *loader = NULL;
+ GError *error = NULL;
+
+ if(gplugin_plugin_get_state(plugin) != GPLUGIN_PLUGIN_STATE_LOADED) {
+ continue;
+ }
+
+ loader = gplugin_plugin_get_loader(plugin);
+ if(!gplugin_loader_unload_plugin(loader, plugin, &error)) {
+ g_warning(
+ "failed to unload plugin with id %s: %s",
+ id,
+ error ? error->message : "unknown");
+ g_clear_error(&error);
+ }
+ g_object_unref(G_OBJECT(loader));
+ }
+}
+
/******************************************************************************
* Manager implementation
*****************************************************************************/
@@ -479,14 +509,11 @@
manager->loaders_by_extension,
e->extension);
for(; l; l = l->next) {
- if(!l->data)
+ if(!GPLUGIN_IS_LOADER(l->data)) {
continue;
+ }
loader = GPLUGIN_LOADER(l->data);
- if(!GPLUGIN_IS_LOADER(loader)) {
- loader = NULL;
- continue;
- }
/* Try to probe the plugin with the current loader */
plugin =
@@ -495,7 +522,7 @@
/* Check the GError, if it's set, output its message and
* try the next loader.
*/
- if(plugin == NULL || error) {
+ if(error) {
errors++;
error_message = g_strdup_printf(
@@ -557,8 +584,13 @@
error_message = g_strdup_printf(
_("Plugin %s has a NULL id."),
real_filename);
+ g_free(real_filename);
+ g_object_unref(G_OBJECT(info));
+
error_messages =
g_list_prepend(error_messages, error_message);
+
+ continue;
}
/* now insert into our view */
@@ -570,7 +602,7 @@
/* Grab the list of plugins with our id and prepend the new
* plugin to it before updating it.
*/
- l = g_hash_table_lookup(manager->plugins, id); //-V1004
+ l = g_hash_table_lookup(manager->plugins, id);
for(ll = l; ll; ll = ll->next) {
GPluginPlugin *splugin = GPLUGIN_PLUGIN(ll->data);
gchar *sfilename = gplugin_plugin_get_filename(splugin);
@@ -627,6 +659,11 @@
}
g_object_unref(G_OBJECT(info));
+
+ /* since the plugin is now stored in our hash tables we
+ * need to remove this function's reference to it.
+ */
+ g_object_unref(G_OBJECT(plugin));
}
g_free(filename);
@@ -655,17 +692,8 @@
g_return_val_if_fail(id != NULL, NULL);
- for(l = g_hash_table_lookup(manager->plugins, id); l; l = l->next) {
- GPluginPlugin *plugin = NULL;
-
- if(l->data == NULL)
- continue;
-
- plugin = GPLUGIN_PLUGIN(l->data);
-
- plugins_list =
- g_slist_prepend(plugins_list, g_object_ref(G_OBJECT(plugin)));
- }
+ l = g_hash_table_lookup(manager->plugins, id);
+ plugins_list = g_slist_copy_deep(l, (GCopyFunc)g_object_ref, NULL);
return plugins_list;
}
@@ -711,9 +739,13 @@
GPluginPlugin *dependency = GPLUGIN_PLUGIN(l->data);
gboolean loaded = FALSE;
- loaded = gplugin_manager_load_plugin(dependency, error);
+ loaded = gplugin_manager_load_plugin(dependency, &ourerror);
- if(!loaded) {
+ if(!loaded || ourerror != NULL) {
+ if(ourerror != NULL) {
+ g_propagate_error(error, ourerror);
+ }
+
all_loaded = FALSE;
break;
}
@@ -737,6 +769,7 @@
info = gplugin_plugin_get_info(plugin);
dependencies = gplugin_plugin_info_get_dependencies(info);
+ g_object_unref(G_OBJECT(info));
if(dependencies == NULL) {
return NULL;
@@ -796,14 +829,10 @@
g_slist_free_full(ret, g_object_unref);
- g_object_unref(G_OBJECT(info));
-
return NULL;
}
}
- g_object_unref(G_OBJECT(info));
-
return ret;
}
@@ -826,12 +855,15 @@
/* now try to get the plugin info from the plugin */
info = gplugin_plugin_get_info(plugin);
if(info == NULL) {
+ gchar *filename = gplugin_plugin_get_filename(plugin);
+
g_set_error(
error,
GPLUGIN_DOMAIN,
0,
_("Plugin %s did not return value plugin info"),
- gplugin_plugin_get_filename(plugin));
+ filename);
+ g_free(filename);
gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
@@ -850,13 +882,16 @@
loader = gplugin_plugin_get_loader(plugin);
if(!GPLUGIN_IS_LOADER(loader)) {
+ gchar *filename = gplugin_plugin_get_filename(plugin);
+
g_set_error(
error,
GPLUGIN_DOMAIN,
0,
_("The loader for %s is not a loader. This "
"should not happened!"),
- gplugin_plugin_get_filename(plugin));
+ filename);
+ g_free(filename);
gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
@@ -941,7 +976,7 @@
}
/******************************************************************************
- * Object Stuff
+ * GObject Implementation
*****************************************************************************/
static void
gplugin_manager_finalize(GObject *obj)
@@ -951,6 +986,12 @@
g_queue_free_full(manager->paths, g_free);
manager->paths = NULL;
+ /* unload all of the loaded plugins */
+ g_hash_table_foreach(
+ manager->plugins,
+ gplugin_manager_foreach_unload_plugin,
+ NULL);
+
/* free all the data in the plugins hash table and destroy it */
g_hash_table_foreach_remove(
manager->plugins,
@@ -1651,8 +1692,8 @@
* Returns a #GList of all plugin id's. Each id should be queried directly
* for more information.
*
- * Return value: (element-type utf8) (transfer full): A #GList of each unique
- * plugin id.
+ * Return value: (element-type utf8) (transfer container): A #GList of each
+ * unique plugin id.
*/
GList *
gplugin_manager_list_plugins(void)
--- a/gplugin/gplugin-native-loader.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-native-loader.c Fri Mar 20 04:44:34 2020 +0000
@@ -241,9 +241,6 @@
return NULL;
}
- /* claim ownership of the info object */
- g_object_ref_sink(G_OBJECT(info));
-
/* now create the actual plugin instance */
/* clang-format off */
plugin = g_object_new(
@@ -261,6 +258,7 @@
g_object_unref(G_OBJECT(info));
if(!GPLUGIN_IS_NATIVE_PLUGIN(plugin)) {
+ g_module_close(module);
g_set_error_literal(
error,
GPLUGIN_DOMAIN,
@@ -311,10 +309,12 @@
/* validate the function */
if(func == NULL) {
- const char *filename = gplugin_plugin_get_filename(plugin);
+ gchar *filename = gplugin_plugin_get_filename(plugin);
g_warning(_("unload function for %s is NULL"), filename);
+ g_free(filename);
+
return FALSE;
}
--- a/gplugin/gplugin-native-plugin.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-native-plugin.c Fri Mar 20 04:44:34 2020 +0000
@@ -196,6 +196,8 @@
g_clear_object(&plugin->loader);
g_clear_object(&plugin->info);
+ g_module_close(plugin->module);
+
G_OBJECT_CLASS(gplugin_native_plugin_parent_class)->finalize(obj);
}
--- a/gplugin/gplugin-plugin-info.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-plugin-info.c Fri Mar 20 04:44:34 2020 +0000
@@ -109,7 +109,7 @@
G_DEFINE_TYPE_WITH_PRIVATE(
GPluginPluginInfo,
gplugin_plugin_info,
- G_TYPE_INITIALLY_UNOWNED)
+ G_TYPE_OBJECT)
/******************************************************************************
* Private API
@@ -477,6 +477,7 @@
g_clear_pointer(&priv->authors, g_strfreev);
g_clear_pointer(&priv->website, g_free);
g_clear_pointer(&priv->dependencies, g_strfreev);
+ g_clear_pointer(&priv->category, g_free);
G_OBJECT_CLASS(gplugin_plugin_info_parent_class)->finalize(obj);
}
--- a/gplugin/gplugin-plugin-info.h Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-plugin-info.h Fri Mar 20 04:44:34 2020 +0000
@@ -33,14 +33,14 @@
gplugin_plugin_info,
GPLUGIN,
PLUGIN_INFO,
- GInitiallyUnowned)
+ GObject)
#include <gplugin/gplugin-loader.h>
#include <gplugin/gplugin-version.h>
struct _GPluginPluginInfoClass {
/*< private >*/
- GInitiallyUnownedClass gparent;
+ GObjectClass parent;
gpointer reserved[4];
};
--- a/gplugin/gplugin-private.h Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/gplugin-private.h Fri Mar 20 04:44:34 2020 +0000
@@ -14,19 +14,19 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-
-#if !defined(GPLUGIN_GLOBAL_HEADER_INSIDE) && !defined(GPLUGIN_COMPILATION)
-#error "only <gplugin.h> may be included directly"
-#endif
-
#ifndef GPLUGIN_PRIVATE_H
#define GPLUGIN_PRIVATE_H
#include <glib.h>
#include <glib-object.h>
+/* this gets included by some tests so we need to trick the headers to accept
+ * it.
+ */
+#define GPLUGIN_GLOBAL_HEADER_INSIDE
#include <gplugin/gplugin-plugin-info.h>
#include <gplugin/gplugin-plugin.h>
+#undef GPLUGIN_GLOBAL_HEADER_INSIDE
G_BEGIN_DECLS
--- a/gplugin/meson.build Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/meson.build Fri Mar 20 04:44:34 2020 +0000
@@ -248,6 +248,7 @@
###############################################################################
# subdirectories
###############################################################################
+subdir('share')
subdir('tests')
if ENABLE_DOC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/share/meson.build Fri Mar 20 04:44:34 2020 +0000
@@ -0,0 +1,2 @@
+subdir('valgrind')
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/share/valgrind/gplugin.supp Fri Mar 20 04:44:34 2020 +0000
@@ -0,0 +1,40 @@
+# GPlugin Valgrind suppressions file
+#
+# This file provides a list of suppressions for all of GPlugin (including
+# GPluginGTK), for all Valgrind tools (memcheck, drd, helgrind, etc.) for the
+# false positives and deliberate one-time leaks which GPlugin causes to be
+# reported when running under Valgrind. Some of these are actually from Glib,
+# but we handle them here because it takes time for them to filter into
+# distribution versions of glib.
+#
+# When running an application which links to GPlugin under Valgrind, you can
+# pass this suppression file to Valgrind using
+# --suppressions=/path/to/gplugin.supp.
+#
+# http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
+#
+# Note that there is currently no way for Valgrind to load this automatically
+# (https://bugs.kde.org/show_bug.cgi?id=160905), so the best GPlugin can
+# currently do is to install this file as part of its development package.
+#
+# This file should be updated if GPlugin introduces a new deliberate one-time
+# leak, or another false positive in Valgrind: please file bugs at:
+# https://issues.imfreedom.org/issues/GPLUGIN
+
+{
+ g-test-add
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ ...
+ fun:g_test_add_vtable
+}
+
+
+{
+ gplugin-register-plugin-state
+ Memcheck:Leak
+ match-leak-kinds: possible
+ ...
+ fun:gplugin_plugin_state_get_type
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/share/valgrind/meson.build Fri Mar 20 04:44:34 2020 +0000
@@ -0,0 +1,2 @@
+install_data('gplugin.supp',
+ install_dir : join_paths(get_option('datadir'), 'gplugin', 'valgrind'))
--- a/gplugin/tests/dynamic-type/dynamic-type-provider.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/dynamic-type/dynamic-type-provider.c Fri Mar 20 04:44:34 2020 +0000
@@ -26,7 +26,6 @@
static void
dynamic_test_init(G_GNUC_UNUSED DynamicTest *inst)
{
- g_message("instance created");
}
static void
@@ -37,7 +36,6 @@
static void
dynamic_test_class_init(G_GNUC_UNUSED DynamicTestClass *klass)
{
- g_message("class created");
}
G_MODULE_EXPORT GPluginPluginInfo *
--- a/gplugin/tests/test-core.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/test-core.c Fri Mar 20 04:44:34 2020 +0000
@@ -20,6 +20,39 @@
#include <gplugin.h>
/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static void
+test_gplugin_count_ids_and_plugins(gint *n_ids, gint *n_plugins)
+{
+ GList *l_ids = NULL, *l_id = NULL;
+ gint ids = 0, plugins = 0;
+
+ l_ids = gplugin_manager_list_plugins();
+ for(l_id = l_ids; l_id; l_id = l_id->next) {
+ GSList *l_plugins = NULL, *l_plugin = NULL;
+ const gchar *id = (const gchar *)l_id->data;
+
+ ids += 1;
+
+ l_plugins = gplugin_manager_find_plugins(id);
+ for(l_plugin = l_plugins; l_plugin; l_plugin = l_plugin->next) {
+ plugins += 1;
+ }
+ g_slist_free_full(l_plugins, g_object_unref);
+ }
+ g_list_free(l_ids);
+
+ if(n_ids) {
+ *n_ids = ids;
+ }
+
+ if(n_plugins) {
+ *n_plugins = plugins;
+ }
+}
+
+/******************************************************************************
* Tests
*****************************************************************************/
static void
@@ -57,8 +90,6 @@
static void
test_gplugin_init_uninit_with_double_refresh_plugins(void)
{
- GList *l = NULL;
- GSList *sl = NULL;
gint f_ids = 0, s_ids = 0, f_plugins = 0, s_plugins = 0;
gplugin_init();
@@ -67,25 +98,11 @@
/* run the first refresh and count everything */
gplugin_manager_refresh();
- for(l = gplugin_manager_list_plugins(); l; l = l->next) {
- const gchar *id = (const gchar *)l->data;
-
- f_ids += 1;
-
- for(sl = gplugin_manager_find_plugins(id); sl; sl = sl->next)
- f_plugins += 1;
- }
+ test_gplugin_count_ids_and_plugins(&f_ids, &f_plugins);
/* now run the second refresh and make sure the counts match */
gplugin_manager_refresh();
- for(l = gplugin_manager_list_plugins(); l; l = l->next) {
- const gchar *id = (const gchar *)l->data;
-
- s_ids += 1;
-
- for(sl = gplugin_manager_find_plugins(id); sl; sl = sl->next)
- s_plugins += 1;
- }
+ test_gplugin_count_ids_and_plugins(&s_ids, &s_plugins);
g_assert_cmpint(f_ids, >, 0);
g_assert_cmpint(f_plugins, >, 0);
@@ -105,8 +122,6 @@
g_test_init(&argc, &argv, NULL);
- gplugin_init();
-
g_test_add_func("/core/init_uninit", test_gplugin_init_uninit);
g_test_add_func("/core/init_init_uninit", test_gplugin_init_init_uninit);
g_test_add_func(
--- a/gplugin/tests/test-loader-registration.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/test-loader-registration.c Fri Mar 20 04:44:34 2020 +0000
@@ -17,10 +17,7 @@
#include <gplugin.h>
-/* it's getting dirty in here... */
-#define GPLUGIN_COMPILATION
#include "../gplugin-private.h"
-#undef GPLUGIN_COMPILATION
#include <glib.h>
@@ -95,7 +92,7 @@
* Tests
*****************************************************************************/
static void
-test_gplugin_manager_loader_register(void)
+test_gplugin_manager_loader_register_unregister(void)
{
GError *error = NULL;
gboolean ret;
@@ -107,6 +104,11 @@
g_assert_true(ret);
g_assert_no_error(error);
+
+ ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
+
+ g_assert_true(ret);
+ g_assert_no_error(error);
}
static void
@@ -125,21 +127,7 @@
ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
-}
-
-static void
-test_gplugin_manager_loader_unregister(void)
-{
- GError *error = NULL;
- gboolean ret;
-
- gplugin_manager_private_uninit();
- gplugin_manager_private_init();
-
- ret = gplugin_manager_register_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
-
- g_assert_true(ret);
- g_assert_no_error(error);
+ g_clear_error(&error);
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
@@ -167,6 +155,7 @@
ret = gplugin_manager_unregister_loader(TEST_GPLUGIN_TYPE_LOADER, &error);
g_assert_false(ret);
g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_clear_error(&error);
}
/******************************************************************************
@@ -175,24 +164,25 @@
gint
main(gint argc, gchar **argv)
{
+ gint r = 0;
g_test_init(&argc, &argv, NULL);
gplugin_init();
g_test_add_func(
- "/manager/loader/register",
- test_gplugin_manager_loader_register);
+ "/manager/loader/register_unregister",
+ test_gplugin_manager_loader_register_unregister);
g_test_add_func(
"/manager/loader/register-twice",
test_gplugin_manager_loader_register_twice);
-
- g_test_add_func(
- "/manager/loader/unregister",
- test_gplugin_manager_loader_unregister);
g_test_add_func(
"/manager/loader/unregister-twice",
test_gplugin_manager_loader_unregister_twice);
- return g_test_run();
+ r = g_test_run();
+
+ gplugin_uninit();
+
+ return r;
}
--- a/gplugin/tests/test-native-loader.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/test-native-loader.c Fri Mar 20 04:44:34 2020 +0000
@@ -49,6 +49,8 @@
/* now attempt to load the dependent plugin, it's supposed to fail */
g_assert_false(gplugin_manager_load_plugin(plugin, &error));
+ g_assert_error(error, GPLUGIN_DOMAIN, 0);
+ g_error_free(error);
}
/******************************************************************************
--- a/gplugin/tests/test-plugin-info.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/test-plugin-info.c Fri Mar 20 04:44:34 2020 +0000
@@ -82,7 +82,6 @@
g_assert_cmpstr(tmp[i], ==, expected[i]);
g_strfreev(got);
- g_strfreev(tmp);
}
/******************************************************************************
@@ -172,6 +171,8 @@
r_dependencies,
(TestStringVFunc)gplugin_plugin_info_get_dependencies,
info);
+
+ g_object_unref(G_OBJECT(info));
}
static void
@@ -282,6 +283,8 @@
r_dependencies,
(TestStringVFunc)gplugin_plugin_info_get_dependencies,
info);
+
+ g_object_unref(G_OBJECT(info));
}
static void
--- a/gplugin/tests/test-versioned-dependencies.c Mon Mar 09 03:03:39 2020 +0000
+++ b/gplugin/tests/test-versioned-dependencies.c Fri Mar 20 04:44:34 2020 +0000
@@ -15,44 +15,24 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-
#include <glib.h>
#include <gplugin.h>
-#include <gplugin-native.h>
/******************************************************************************
* Helpers
*****************************************************************************/
static void
-_test_plugin_load_and_has_dependent(
- GPluginPlugin *dependent,
- G_GNUC_UNUSED const gchar *id)
+_test_plugin_loaded(GPluginPlugin *dependent, const gchar *id)
{
GPluginPlugin *plugin = NULL;
- GSList *deps = NULL, *l = NULL;
- gboolean found = FALSE;
- plugin = gplugin_manager_find_plugin("gplugin/test-no-version");
+ plugin = gplugin_manager_find_plugin(id);
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
GPLUGIN_PLUGIN_STATE_LOADED);
- deps = gplugin_manager_get_plugin_dependencies(plugin, NULL);
- if(deps != NULL) {
- for(l = deps; l; l = l->next) {
- if(l->data == dependent) {
- found = TRUE;
- }
- }
-
- g_slist_free_full(deps, g_object_unref);
-
- g_assert_true(found);
- }
-
g_object_unref(G_OBJECT(plugin));
}
@@ -64,8 +44,10 @@
{
GPluginPlugin *plugin = NULL;
GError *error = NULL;
+ gboolean ret = FALSE;
- gplugin_manager_remove_paths();
+ gplugin_init();
+
gplugin_manager_append_path(TEST_VERSIONED_DEPENDENCY_DIR);
gplugin_manager_refresh();
@@ -73,26 +55,31 @@
g_assert_nonnull(plugin);
g_assert_true(GPLUGIN_IS_PLUGIN(plugin));
- gplugin_manager_load_plugin(plugin, &error);
+ ret = gplugin_manager_load_plugin(plugin, &error);
+
+ g_assert_true(ret);
g_assert_no_error(error);
g_assert_cmpint(
gplugin_plugin_get_state(plugin),
==,
GPLUGIN_PLUGIN_STATE_LOADED);
- g_object_unref(G_OBJECT(plugin));
/* now make sure each dependent plugin that's available was loaded */
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-no-version");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-exact1");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-exact2");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-greater");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-greater-equal");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-less");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/test-less-equal");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/bar");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/baz");
- _test_plugin_load_and_has_dependent(plugin, "gplugin/fez");
+ _test_plugin_loaded(plugin, "gplugin/test-no-version");
+ _test_plugin_loaded(plugin, "gplugin/test-exact1");
+ _test_plugin_loaded(plugin, "gplugin/test-exact2");
+ _test_plugin_loaded(plugin, "gplugin/test-greater");
+ _test_plugin_loaded(plugin, "gplugin/test-greater-equal");
+ _test_plugin_loaded(plugin, "gplugin/test-less");
+ _test_plugin_loaded(plugin, "gplugin/test-less-equal");
+ _test_plugin_loaded(plugin, "gplugin/bar");
+ _test_plugin_loaded(plugin, "gplugin/baz");
+ _test_plugin_loaded(plugin, "gplugin/fez");
+
+ g_object_unref(G_OBJECT(plugin));
+
+ gplugin_uninit();
}
/******************************************************************************
@@ -101,11 +88,8 @@
gint
main(gint argc, gchar **argv)
{
-
g_test_init(&argc, &argv, NULL);
- gplugin_init();
-
/* test the load on query flag */
g_test_add_func(
"/dependent-versions/super-dependent",
--- a/packaging/debian/libgplugin-dev.install Mon Mar 09 03:03:39 2020 +0000
+++ b/packaging/debian/libgplugin-dev.install Fri Mar 20 04:44:34 2020 +0000
@@ -3,6 +3,7 @@
debian/tmp/usr/include/gplugin-1.0/gplugin-native.h
debian/tmp/usr/lib/*/libgplugin.so
debian/tmp/usr/lib/*/pkgconfig/gplugin.pc
+debian/tmp/usr/share/gplugin/valgrind/gplugin.supp
debian/tmp/usr/share/vala/vapi/gplugin.deps
debian/tmp/usr/share/vala/vapi/gplugin.vapi
--- a/packaging/gplugin.spec.in Mon Mar 09 03:03:39 2020 +0000
+++ b/packaging/gplugin.spec.in Fri Mar 20 04:44:34 2020 +0000
@@ -182,6 +182,7 @@
%defattr(-,root,root)
%doc HACKING.md README.md
%license COPYING
+%{_datadir}/gplugin/
%{_datadir}/gir-1.0/GPlugin-0.0.gir
%{_datadir}/gtk-doc/html/gplugin/
%{_includedir}/gplugin-1.0/