Enable GIO tests on Windows

1) Remove the non-Windows-only condition for subdir('tests').
2) Add libiphlpapi, libws2_32 and libsecur32 deps, needed for W32 tests.
3) Remove the -no-undefined argument (gcc doesn't understand it,
   it *does* understand -Wl,-no-undefined; either way, the test
   compiles without this argument just fine; maybe meson adds it
   by itself - you can hardly build shared modules without it).
4) Add or fix a number of includes
5) Disable gdbus-objectmanager tests when building with MSVC
   (right now these tests don't work on Windows anyway, so the fact
    that MSVC can't even build them properly is irrelevant;
    most likely gdbus-codegen needs changes to put _GLIB_EXTERN
    before each function)
This commit is contained in:
Руслан Ижбулатов 2018-09-09 12:46:33 +00:00
parent cf4ea5ef75
commit ad3694b82a
8 changed files with 39 additions and 26 deletions

View File

@ -979,7 +979,4 @@ if enable_systemtap
endif
subdir('fam')
if host_system != 'windows'
subdir('tests')
endif
subdir('tests')

View File

@ -29,8 +29,9 @@
#ifdef G_OS_WIN32
#include <stdio.h>
#include <glib/gstdio.h>
#include <Windows.h>
#include <Shlobj.h>
#include <windows.h>
#include <shlobj.h>
#include <io.h> /* for _get_osfhandle */
#endif
#define TEST_NAME "Prilis zlutoucky kun"

View File

@ -22,7 +22,9 @@
#include <gio/gio.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <dbus/dbus.h>
/* ---------------------------------------------------------------------------------------------------- */

View File

@ -19,7 +19,9 @@
*/
#include <gio/gio.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include "gdbus-tests.h"

View File

@ -5,6 +5,10 @@ common_gio_tests_deps = [
libgio_dep,
]
if host_machine.system() == 'windows'
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
endif
subdir('gdbus-object-manager-example')
gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
@ -321,22 +325,27 @@ test_extra_programs += [{
'extra_sources' : ['gtlsconsoleinteraction.c'],
'install' : false,
},
# These three are manual-run tests because they need a session bus but don't bring one up themselves
# FIXME: these build but don't seem to work!
'gdbus-example-objectmanager-client' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-example-objectmanager-server' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-test-fixture' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
}]
if cc.get_id() != 'msvc'
test_extra_programs += [{
# These three are manual-run tests because they need a session bus but don't bring one up themselves
# FIXME: these build but don't seem to work!
'gdbus-example-objectmanager-client' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-example-objectmanager-server' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-test-fixture' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
}]
endif
if host_machine.system() != 'windows'
test_extra_programs += [{
'gdbus-example-unix-fd-client' : {
@ -357,13 +366,8 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--c-name', '_g_plugin',
'@INPUT@'])
if host_system == 'windows'
resource_plugin_platform_link_args = ['-no-undefined']
else
resource_plugin_platform_link_args = []
endif
shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
link_args : export_dynamic_ldflags,
dependencies : common_gio_tests_deps)
test_gresource = custom_target('test.gresource',

View File

@ -20,6 +20,8 @@
* if advised of the possibility of such damage.
*/
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h>
#include "symbol-visibility.h"

View File

@ -20,6 +20,8 @@
* if advised of the possibility of such damage.
*/
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h>
#include "symbol-visibility.h"

View File

@ -6,6 +6,9 @@
#ifdef G_OS_UNIX
#include <unistd.h>
#endif
#ifdef G_OS_WIN32
#include <io.h> /* for close() */
#endif
static const char *original_data = "This is some test data that we can put in a file...";
static const char *new_data = "new data..";