Fix test failures for static builds

The plugin modules in these tests get statically linked with a separate
copy of GLib so they end up calling vfuncs in their own copy of GLib.

Fixes #1648
This commit is contained in:
DDoSolitary 2019-07-15 11:01:04 +00:00 committed by Philip Withnall
parent 618d3e4a0a
commit 2718245dc2
3 changed files with 23 additions and 1 deletions

View File

@ -21,6 +21,7 @@
*/
#include <gio/gio.h>
#include <glibconfig.h>
#ifdef _MSC_VER
# define MODULE_FILENAME_PREFIX ""
@ -82,6 +83,13 @@ test_extension_point (void)
static void
test_module_scan_all (void)
{
#ifdef GLIB_STATIC_COMPILATION
/* The plugin module is statically linked with a separate copy
* of GLib so g_io_extension_point_implement won't work. */
g_test_skip ("GIOExtensionPoint with dynamic modules isn't supported in static builds.");
return;
#endif
if (g_test_subprocess ())
{
GIOExtensionPoint *ep;
@ -104,6 +112,12 @@ test_module_scan_all (void)
static void
test_module_scan_all_with_scope (void)
{
#ifdef GLIB_STATIC_COMPILATION
/* Disabled for the same reason as test_module_scan_all. */
g_test_skip ("GIOExtensionPoint with dynamic modules isn't supported in static builds.");
return;
#endif
if (g_test_subprocess ())
{
GIOExtensionPoint *ep;

View File

@ -18,6 +18,7 @@
#include <string.h>
#include <gio/gio.h>
#include <glibconfig.h>
#include "gconstructor.h"
#include "test_resources2.h"
#include "digit_test_resources.h"
@ -644,6 +645,13 @@ test_resource_module (void)
GBytes *data;
GError *error;
#ifdef GLIB_STATIC_COMPILATION
/* The resource module is statically linked with a separate copy
* of a GLib so g_static_resource_init won't work as expected. */
g_test_skip ("Resource modules aren't supported in static builds.");
return;
#endif
if (g_module_supported ())
{
module = g_io_module_new (g_test_get_filename (G_TEST_BUILT,

View File

@ -183,7 +183,7 @@ if get_option('default_library') != 'static'
endif
endif
if host_system == 'windows' and get_option('default_library') == 'static'
if get_option('default_library') == 'static'
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
endif