summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2019-06-21 13:04:34 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2019-06-24 10:58:58 +0800
commitdbea8d54490914a127ba93388b67f758647a0cbe (patch)
tree0ed94d24ef7629be7d4f1c8b219bb982ed150d01
parentedc5eb98c210f01a7ed398a821c689e157e3311b (diff)
downloadglib-dbea8d54490914a127ba93388b67f758647a0cbe.tar.gz
Fix module tests on Visual Studio builds
On Visual Studio, Meson builds modules as xxxx.dll, not libxxxx.dll when xxxx is specified as the name for the shared_module() build directive. This means that in the test programs if we expect for libxxxx for the module name, the test will fail as there is no libxxxx.dll but there is xxxx.dll. This makes the test program look for the module files correctly.
-rw-r--r--gio/tests/giomodule.c8
-rw-r--r--gio/tests/resources.c10
-rw-r--r--tests/module-test.c10
3 files changed, 24 insertions, 4 deletions
diff --git a/gio/tests/giomodule.c b/gio/tests/giomodule.c
index e832e95d3..cceabb8c4 100644
--- a/gio/tests/giomodule.c
+++ b/gio/tests/giomodule.c
@@ -22,6 +22,12 @@
#include <gio/gio.h>
+#ifdef _MSC_VER
+# define MODULE_FILENAME_PREFIX ""
+#else
+# define MODULE_FILENAME_PREFIX "lib"
+#endif
+
static void
test_extension_point (void)
{
@@ -108,7 +114,7 @@ test_module_scan_all_with_scope (void)
ep = g_io_extension_point_register ("test-extension-point");
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
- g_io_module_scope_block (scope, "libtestmoduleb." G_MODULE_SUFFIX);
+ g_io_module_scope_block (scope, MODULE_FILENAME_PREFIX "testmoduleb." G_MODULE_SUFFIX);
g_io_modules_scan_all_in_directory_with_scope (g_test_get_filename (G_TEST_BUILT, "modules", NULL), scope);
list = g_io_extension_point_get_extensions (ep);
g_io_modules_scan_all_in_directory_with_scope (g_test_get_filename (G_TEST_BUILT, "modules/.libs", NULL), scope);
diff --git a/gio/tests/resources.c b/gio/tests/resources.c
index cb2c00a48..00e466aef 100644
--- a/gio/tests/resources.c
+++ b/gio/tests/resources.c
@@ -22,6 +22,12 @@
#include "test_resources2.h"
#include "digit_test_resources.h"
+#ifdef _MSC_VER
+# define MODULE_FILENAME_PREFIX ""
+#else
+# define MODULE_FILENAME_PREFIX "lib"
+#endif
+
static void
test_resource (GResource *resource)
{
@@ -641,7 +647,9 @@ test_resource_module (void)
if (g_module_supported ())
{
/* For in-tree, this will find the .la file and use it to get to the .so in .libs/ */
- module = g_io_module_new (g_test_get_filename (G_TEST_BUILT, "libresourceplugin", NULL));
+ module = g_io_module_new (g_test_get_filename (G_TEST_BUILT,
+ MODULE_FILENAME_PREFIX "resourceplugin",
+ NULL));
error = NULL;
diff --git a/tests/module-test.c b/tests/module-test.c
index fbf23169f..8047b74ec 100644
--- a/tests/module-test.c
+++ b/tests/module-test.c
@@ -28,6 +28,12 @@
#include <gmodule.h>
#include <string.h>
+#ifdef _MSC_VER
+# define MODULE_FILENAME_PREFIX ""
+#else
+# define MODULE_FILENAME_PREFIX "lib"
+#endif
+
gchar* global_state;
G_MODULE_EXPORT void g_clash_func (void);
@@ -84,8 +90,8 @@ main (int argc,
if (!g_module_supported ())
g_error ("dynamic modules not supported");
- plugin_a = g_test_build_filename (G_TEST_BUILT, "libmoduletestplugin_a", NULL);
- plugin_b = g_test_build_filename (G_TEST_BUILT, "libmoduletestplugin_b", NULL);
+ plugin_a = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_a", NULL);
+ plugin_b = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_b", NULL);
/* module handles */