[glib/wip/meson: 10/35] meson: Add tls-interaction test, and fix giomodule test



commit ea6a6a5700a79a990099f953b2a8854db1ff18cb
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Wed Dec 21 07:46:30 2016 +0530

    meson: Add tls-interaction test, and fix giomodule test
    
    giomodule test needed symbol visibility pragmas added. This is needed on
    Windows anyway, so it's better to do it this way rather than disabling
    -fvisibility=hidden for the test modules.

 gio/tests/meson.build                 |    8 ++++++++
 gio/tests/modules/symbol-visibility.h |   16 ++++++++++++++++
 gio/tests/modules/test-module-a.c     |    6 ++++--
 gio/tests/modules/test-module-b.c     |    6 ++++--
 4 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 1a3cbd9..d82aede 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -144,6 +144,12 @@ exe = executable('tls-certificate', 'tls-certificate.c', 'gtesttlsbackend.c',
 )
 test('tls-certificate', exe, env : test_env)
 
+exe = executable('tls-interaction', 'tls-interaction.c', 'gtesttlsbackend.c',
+  c_args : test_c_args,
+  dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
+)
+test('tls-interaction', exe, env : test_env)
+
 exe = executable('socket-client', 'socket-client.c', 'gtlsconsoleinteraction.c',
   c_args : test_c_args,
   dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
@@ -156,6 +162,8 @@ exe = executable('socket-client', 'socket-client.c', 'gtlsconsoleinteraction.c',
 #)
 #test('gdbus-daemon', exe, env : test_env)
 
+# FIXME: Add resources test
+
 foo = '''
 c_args_atomic = [ ]
 if cc.get_id() == 'gcc'
diff --git a/gio/tests/modules/symbol-visibility.h b/gio/tests/modules/symbol-visibility.h
new file mode 100644
index 0000000..f9f8826
--- /dev/null
+++ b/gio/tests/modules/symbol-visibility.h
@@ -0,0 +1,16 @@
+#ifndef GLIB_TEST_SYMBOL_VISIBILITY
+#define GLIB_TEST_SYMBOL_VISIBILITY
+
+/* This is the same check that's done in configure to create config.h */
+#ifdef _WIN32
+# ifdef _MSC_VER
+#  define GLIB_TEST_EXPORT_SYMBOL __declspec(dllexport) extern
+# else
+#  define GLIB_TEST_EXPORT_SYMBOL __attribute__((visibility("default"))) __declspec(dllexport) extern
+# endif
+/* Matches GCC and Clang */
+#elif defined(__GNUC__) && (__GNUC__ >= 4)
+# define GLIB_TEST_EXPORT_SYMBOL __attribute__((visibility("default"))) extern
+#endif
+
+#endif /* GLIB_TEST_SYMBOL_VISIBILITY */
diff --git a/gio/tests/modules/test-module-a.c b/gio/tests/modules/test-module-a.c
index ffe7ae3..0644fdc 100644
--- a/gio/tests/modules/test-module-a.c
+++ b/gio/tests/modules/test-module-a.c
@@ -22,6 +22,8 @@
 
 #include <gio/gio.h>
 
+#include "symbol-visibility.h"
+
 typedef struct _TestA {
   GObject parent;
 } TestA;
@@ -42,7 +44,7 @@ test_a_init (TestA *self)
 {
 }
 
-void
+GLIB_TEST_EXPORT_SYMBOL void
 g_io_module_load (GIOModule *module)
 {
   g_io_extension_point_implement ("test-extension-point",
@@ -51,7 +53,7 @@ g_io_module_load (GIOModule *module)
                                   30);
 }
 
-void
+GLIB_TEST_EXPORT_SYMBOL void
 g_io_module_unload (GIOModule *module)
 {
 }
diff --git a/gio/tests/modules/test-module-b.c b/gio/tests/modules/test-module-b.c
index aaf15d6..5ec9208 100644
--- a/gio/tests/modules/test-module-b.c
+++ b/gio/tests/modules/test-module-b.c
@@ -22,6 +22,8 @@
 
 #include <gio/gio.h>
 
+#include "symbol-visibility.h"
+
 typedef struct _TestB {
   GObject parent;
 } TestB;
@@ -42,7 +44,7 @@ test_b_init (TestB *self)
 {
 }
 
-void
+GLIB_TEST_EXPORT_SYMBOL void
 g_io_module_load (GIOModule *module)
 {
   g_io_extension_point_implement ("test-extension-point",
@@ -51,7 +53,7 @@ g_io_module_load (GIOModule *module)
                                   40);
 }
 
-void
+GLIB_TEST_EXPORT_SYMBOL void
 g_io_module_unload (GIOModule *module)
 {
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]