2018-04-20 18:09:32 +02:00
|
|
|
common_gio_tests_deps = [
|
|
|
|
libglib_dep,
|
|
|
|
libgmodule_dep,
|
|
|
|
libgobject_dep,
|
|
|
|
libgio_dep,
|
|
|
|
]
|
2017-12-11 02:33:24 +01:00
|
|
|
|
2018-11-09 19:23:43 +01:00
|
|
|
test_c_args = [
|
|
|
|
'-DG_LOG_DOMAIN="GLib-GIO"',
|
|
|
|
'-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
|
|
|
|
'-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
|
2019-03-05 11:55:19 +01:00
|
|
|
'-UG_DISABLE_ASSERT',
|
2018-11-09 19:23:43 +01:00
|
|
|
]
|
|
|
|
|
2021-03-02 14:15:50 +01:00
|
|
|
# workaround for https://github.com/mesonbuild/meson/issues/6880
|
|
|
|
if build_machine.system() == 'linux'
|
|
|
|
libutil_name = 'libutil'
|
|
|
|
libutil = run_command('sh', '-c',
|
|
|
|
'''ldconfig -p | grep -o "[[:space:]]@0@\.so\(\.[0-9]\+\)\?\b"'''
|
2021-11-24 06:31:18 +01:00
|
|
|
.format(libutil_name), check: false).stdout().strip().split('\n')
|
2021-03-02 14:15:50 +01:00
|
|
|
|
|
|
|
if libutil.length() > 0
|
|
|
|
message('Found libutil as @0@'.format(libutil[0]))
|
|
|
|
test_c_args += '-DLIBUTIL_SONAME="@0@"'.format(libutil[0])
|
|
|
|
else
|
|
|
|
warning('libutil not found')
|
|
|
|
endif # libutil.length() > 0
|
|
|
|
endif # build_machine.system() == 'linux'
|
|
|
|
|
2018-09-09 14:46:33 +02:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
|
|
|
|
endif
|
|
|
|
|
2017-01-28 13:52:18 +01:00
|
|
|
subdir('gdbus-object-manager-example')
|
|
|
|
|
|
|
|
gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
|
|
|
|
giotypefuncs_inc = custom_target(
|
|
|
|
'giotypefuncs.inc',
|
|
|
|
output : 'giotypefuncs.inc',
|
|
|
|
input : gio_headers + [gioenumtypes_h] + gobject_install_headers,
|
|
|
|
command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
|
|
|
|
|
2016-03-07 12:13:24 +01:00
|
|
|
# Test programs buildable on all platforms
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests = {
|
2018-08-15 18:25:14 +02:00
|
|
|
'appmonitor' : {},
|
|
|
|
'async-close-output-stream' : {},
|
|
|
|
'async-splice-output-stream' : {},
|
|
|
|
'buffered-input-stream' : {},
|
|
|
|
'buffered-output-stream' : {},
|
|
|
|
'cancellable' : {},
|
|
|
|
'contexts' : {},
|
|
|
|
'contenttype' : {},
|
|
|
|
'converter-stream' : {},
|
|
|
|
'credentials' : {},
|
2021-12-13 16:06:47 +01:00
|
|
|
'cxx' : {
|
|
|
|
'source' : ['cxx.cpp'],
|
|
|
|
},
|
2018-08-15 18:25:14 +02:00
|
|
|
'data-input-stream' : {},
|
|
|
|
'data-output-stream' : {},
|
|
|
|
'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
|
|
|
|
'fileattributematcher' : {},
|
|
|
|
'filter-streams' : {},
|
|
|
|
'giomodule' : {},
|
|
|
|
'gsubprocess' : {},
|
|
|
|
'g-file' : {},
|
|
|
|
'g-file-info' : {},
|
|
|
|
'g-icon' : {},
|
|
|
|
'gdbus-addresses' : {},
|
|
|
|
'gdbus-message' : {},
|
|
|
|
'inet-address' : {},
|
|
|
|
'io-stream' : {},
|
|
|
|
'memory-input-stream' : {},
|
2019-09-19 16:21:23 +02:00
|
|
|
'memory-monitor' : {},
|
2018-08-15 18:25:14 +02:00
|
|
|
'memory-output-stream' : {},
|
|
|
|
'mount-operation' : {},
|
2019-02-07 15:51:54 +01:00
|
|
|
'network-address' : {'extra_sources': ['mock-resolver.c']},
|
2018-08-15 18:25:14 +02:00
|
|
|
'network-monitor' : {},
|
|
|
|
'network-monitor-race' : {},
|
|
|
|
'permission' : {},
|
2021-01-19 22:14:41 +01:00
|
|
|
'pollable' : {'dependencies' : [libdl_dep]},
|
2021-07-20 23:04:31 +02:00
|
|
|
'power-profile-monitor' : {},
|
2018-08-15 18:25:14 +02:00
|
|
|
'proxy-test' : {},
|
|
|
|
'readwrite' : {},
|
|
|
|
'simple-async-result' : {},
|
|
|
|
'simple-proxy' : {},
|
|
|
|
'sleepy-stream' : {},
|
|
|
|
'socket' : {},
|
|
|
|
'socket-listener' : {},
|
2019-02-21 19:13:47 +01:00
|
|
|
'socket-service' : {},
|
2018-08-15 18:25:14 +02:00
|
|
|
'srvtarget' : {},
|
|
|
|
'task' : {},
|
|
|
|
'vfs' : {},
|
|
|
|
'volumemonitor' : {},
|
|
|
|
'glistmodel' : {},
|
2019-01-09 11:48:42 +01:00
|
|
|
'testfilemonitor' : {'suite' : ['slow', 'flaky']},
|
2018-08-15 18:25:14 +02:00
|
|
|
'thumbnail-verification' : {},
|
|
|
|
'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
|
|
|
|
'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
|
2018-08-16 15:25:29 +02:00
|
|
|
'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']},
|
2021-06-03 14:01:29 +02:00
|
|
|
'tls-bindings' : {'extra_sources' : ['gtesttlsbackend.c']},
|
2019-01-29 21:10:57 +01:00
|
|
|
'gdbus-address-get-session' : {},
|
2019-11-29 17:48:32 +01:00
|
|
|
'win32-appinfo' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2018-08-15 18:25:14 +02:00
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs = {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-connection-flush-helper' : {},
|
|
|
|
'gdbus-testserver' : {},
|
2018-09-19 17:53:07 +02:00
|
|
|
'gsubprocess-testprog' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2016-03-07 12:13:24 +01:00
|
|
|
|
2019-12-02 15:05:22 +01:00
|
|
|
python_tests = [
|
|
|
|
'codegen.py',
|
|
|
|
]
|
|
|
|
|
2018-07-16 17:52:53 +02:00
|
|
|
test_env = environment()
|
|
|
|
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
|
|
|
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
|
|
|
test_env.set('GIO_MODULE_DIR', '')
|
2017-02-23 17:13:23 +01:00
|
|
|
|
|
|
|
# Check for libdbus1 - Optional - is only used in the GDBus test cases
|
|
|
|
# 1.2.14 required for dbus_message_set_serial
|
|
|
|
dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
|
2017-08-15 11:08:47 +02:00
|
|
|
if not dbus1_dep.found()
|
2019-07-09 18:22:51 +02:00
|
|
|
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
2017-08-15 11:08:47 +02:00
|
|
|
# MSVC: Search for the DBus library by the configuration, which corresponds
|
|
|
|
# to the output of CMake builds of DBus. Note that debugoptimized
|
|
|
|
# is really a Release build with .PDB files.
|
2020-03-12 13:12:27 +01:00
|
|
|
if vs_crt == 'debug'
|
2017-08-15 11:08:47 +02:00
|
|
|
dbus1_dep = cc.find_library('dbus-1d', required : false)
|
|
|
|
else
|
|
|
|
dbus1_dep = cc.find_library('dbus-1', required : false)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2017-02-23 17:13:23 +01:00
|
|
|
if dbus1_dep.found()
|
|
|
|
glib_conf.set('HAVE_DBUS1', 1)
|
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-serialization' : {
|
|
|
|
'extra_sources' : ['gdbus-tests.c'],
|
|
|
|
'dependencies' : [dbus1_dep],
|
2019-10-11 20:02:55 +02:00
|
|
|
},
|
|
|
|
'gdbus-server-auth' : {
|
|
|
|
'dependencies' : [dbus1_dep],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# We can build a cut-down version of this test without libdbus
|
|
|
|
gio_tests += {
|
|
|
|
'gdbus-server-auth' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-02-23 17:13:23 +01:00
|
|
|
endif
|
|
|
|
|
2016-03-07 12:13:24 +01:00
|
|
|
# Test programs buildable on UNIX only
|
|
|
|
if host_machine.system() != 'windows'
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'file' : {},
|
2018-09-24 19:32:08 +02:00
|
|
|
'gdbus-peer' : {
|
|
|
|
'dependencies' : [libgdbus_example_objectmanager_dep],
|
2019-02-14 14:20:16 +01:00
|
|
|
'install_rpath' : installed_tests_execdir
|
2018-09-24 19:32:08 +02:00
|
|
|
},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-peer-object-manager' : {},
|
|
|
|
'live-g-file' : {},
|
|
|
|
'socket-address' : {},
|
|
|
|
'stream-rw_all' : {},
|
|
|
|
'unix-fd' : {},
|
|
|
|
'unix-mounts' : {},
|
|
|
|
'unix-streams' : {},
|
|
|
|
'g-file-info-filesystem-readonly' : {},
|
|
|
|
'gschema-compile' : {'install' : false},
|
|
|
|
'trash' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-02-24 10:46:36 +01:00
|
|
|
|
2021-01-29 21:24:03 +01:00
|
|
|
# LD_PRELOAD modules don't work so well with AddressSanitizer
|
|
|
|
if have_rtld_next and get_option('b_sanitize') == 'none'
|
2019-03-20 19:52:48 +01:00
|
|
|
gio_tests += {
|
|
|
|
'gsocketclient-slow' : {
|
|
|
|
'depends' : [
|
|
|
|
shared_library('slow-connect-preload',
|
|
|
|
'slow-connect-preload.c',
|
|
|
|
name_prefix : '',
|
2019-08-29 17:19:08 +02:00
|
|
|
dependencies: libdl_dep,
|
2019-03-20 19:52:48 +01:00
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install: installed_tests_enabled,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
'env' : {
|
|
|
|
'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(meson.current_build_dir())
|
|
|
|
},
|
|
|
|
'installed_tests_env' : {
|
|
|
|
'LD_PRELOAD': '@0@/slow-connect-preload.so'.format(installed_tests_execdir),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
endif
|
|
|
|
|
2017-02-24 10:46:36 +01:00
|
|
|
# Uninstalled because of the check-for-executable logic in DesktopAppInfo
|
|
|
|
# unable to find the installed executable
|
2017-05-13 12:10:52 +02:00
|
|
|
if not glib_have_cocoa
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'appinfo' : {
|
|
|
|
'install' : false,
|
|
|
|
},
|
|
|
|
'desktop-app-info' : {
|
|
|
|
'install' : false,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-05-13 12:10:52 +02:00
|
|
|
endif
|
2017-01-28 13:52:18 +01:00
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'basic-application' : {},
|
|
|
|
'dbus-launch' : {},
|
|
|
|
'appinfo-test' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-01-28 13:52:18 +01:00
|
|
|
|
2017-05-13 12:10:52 +02:00
|
|
|
if not glib_have_cocoa
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'apps' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'mimeapps' : {},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-05-13 12:10:52 +02:00
|
|
|
endif
|
|
|
|
|
2017-02-23 17:13:23 +01:00
|
|
|
# Test programs that need to bring up a session bus (requires dbus-daemon)
|
2017-01-28 13:52:18 +01:00
|
|
|
have_dbus_daemon = find_program('dbus-daemon', required : false).found()
|
|
|
|
if have_dbus_daemon
|
2018-12-06 22:38:39 +01:00
|
|
|
annotate_args = [
|
|
|
|
'--annotate', 'org.project.Bar', 'Key1', 'Value1',
|
|
|
|
'--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
|
|
|
|
'--annotate', 'org.project.Bar.HelloWorld()', 'Key3', 'Value3',
|
|
|
|
'--annotate', 'org.project.Bar::TestSignal', 'Key4', 'Value4',
|
|
|
|
'--annotate', 'org.project.Bar:ay', 'Key5', 'Value5',
|
|
|
|
'--annotate', 'org.project.Bar.TestPrimitiveTypes()[val_int32]', 'Key6', 'Value6',
|
|
|
|
'--annotate', 'org.project.Bar.TestPrimitiveTypes()[ret_uint32]', 'Key7', 'Value7',
|
|
|
|
'--annotate', 'org.project.Bar::TestSignal[array_of_strings]', 'Key8', 'Value8',
|
|
|
|
]
|
2017-02-23 17:13:23 +01:00
|
|
|
# Generate gdbus-test-codegen-generated.{c,h}
|
|
|
|
gdbus_test_codegen_generated = custom_target('gdbus-test-codegen-generated',
|
|
|
|
input : ['test-codegen.xml'],
|
|
|
|
output : ['gdbus-test-codegen-generated.h',
|
|
|
|
'gdbus-test-codegen-generated.c'],
|
2017-10-11 12:36:58 +02:00
|
|
|
depend_files : gdbus_codegen_built_files,
|
2017-02-23 17:13:23 +01:00
|
|
|
command : [python, gdbus_codegen,
|
|
|
|
'--interface-prefix', 'org.project.',
|
2017-07-14 04:22:16 +02:00
|
|
|
'--output-directory', '@OUTDIR@',
|
|
|
|
'--generate-c-code', 'gdbus-test-codegen-generated',
|
2017-02-23 17:13:23 +01:00
|
|
|
'--c-generate-object-manager',
|
2018-10-26 14:49:54 +02:00
|
|
|
'--c-generate-autocleanup', 'all',
|
2017-02-23 17:13:23 +01:00
|
|
|
'--c-namespace', 'Foo_iGen',
|
|
|
|
'--generate-docbook', 'gdbus-test-codegen-generated-doc',
|
2018-12-06 22:38:39 +01:00
|
|
|
annotate_args,
|
2017-02-23 17:13:23 +01:00
|
|
|
'@INPUT@'])
|
2020-01-27 11:11:46 +01:00
|
|
|
# Generate gdbus-test-codegen-generated-min-required-2-64.{c,h}
|
|
|
|
gdbus_test_codegen_generated_min_required_2_64 = custom_target('gdbus-test-codegen-generated-min-required-2-64',
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
input : ['test-codegen.xml'],
|
2020-01-27 11:11:46 +01:00
|
|
|
output : ['gdbus-test-codegen-generated-min-required-2-64.h',
|
|
|
|
'gdbus-test-codegen-generated-min-required-2-64.c'],
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
depend_files : gdbus_codegen_built_files,
|
|
|
|
command : [python, gdbus_codegen,
|
2020-01-27 11:11:46 +01:00
|
|
|
'--glib-min-required', '2.64',
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
'--interface-prefix', 'org.project.',
|
|
|
|
'--output-directory', '@OUTDIR@',
|
2020-01-27 11:11:46 +01:00
|
|
|
'--generate-c-code', 'gdbus-test-codegen-generated-min-required-2-64',
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
'--c-generate-object-manager',
|
|
|
|
'--c-generate-autocleanup', 'all',
|
|
|
|
'--c-namespace', 'Foo_iGen',
|
|
|
|
'--generate-docbook', 'gdbus-test-codegen-generated-doc',
|
|
|
|
annotate_args,
|
|
|
|
'@INPUT@'])
|
2018-12-06 22:38:39 +01:00
|
|
|
gdbus_test_codegen_generated_interface_info = [
|
|
|
|
custom_target('gdbus-test-codegen-generated-interface-info-h',
|
|
|
|
input : ['test-codegen.xml'],
|
|
|
|
output : ['gdbus-test-codegen-generated-interface-info.h'],
|
|
|
|
depend_files : gdbus_codegen_built_files,
|
|
|
|
command : [python, gdbus_codegen,
|
|
|
|
'--interface-info-header',
|
|
|
|
annotate_args,
|
|
|
|
'--output', '@OUTPUT@',
|
|
|
|
'@INPUT@']),
|
|
|
|
custom_target('gdbus-test-codegen-generated-interface-info-c',
|
|
|
|
input : ['test-codegen.xml'],
|
|
|
|
output : ['gdbus-test-codegen-generated-interface-info.c'],
|
|
|
|
depend_files : gdbus_codegen_built_files,
|
|
|
|
command : [python, gdbus_codegen,
|
|
|
|
'--interface-info-body',
|
|
|
|
annotate_args,
|
|
|
|
'--output', '@OUTPUT@',
|
|
|
|
'@INPUT@']),
|
|
|
|
]
|
|
|
|
|
2018-08-15 18:25:14 +02:00
|
|
|
extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
|
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'actions' : {
|
|
|
|
'extra_sources' : extra_sources,
|
|
|
|
'suite' : ['slow'],
|
|
|
|
},
|
2019-04-12 18:08:22 +02:00
|
|
|
'gdbus-auth' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-bz627724' : {'extra_sources' : extra_sources},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-close-pending' : {'extra_sources' : extra_sources},
|
2019-04-12 18:08:22 +02:00
|
|
|
'gdbus-connection' : {'extra_sources' : extra_sources},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-connection-loss' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-connection-slow' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-error' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-exit-on-close' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-export' : {
|
|
|
|
'extra_sources' : extra_sources,
|
|
|
|
'suite' : ['slow'],
|
|
|
|
},
|
|
|
|
'gdbus-introspection' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-names' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-proxy' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-proxy-threads' : {
|
|
|
|
'extra_sources' : extra_sources,
|
|
|
|
'dependencies' : [dbus1_dep],
|
|
|
|
},
|
2017-12-06 19:34:17 +01:00
|
|
|
'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
|
|
|
|
'gdbus-test-codegen' : {
|
2018-12-06 22:38:39 +01:00
|
|
|
'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
|
2018-08-15 18:25:14 +02:00
|
|
|
},
|
|
|
|
'gdbus-threading' : {
|
|
|
|
'extra_sources' : extra_sources,
|
2020-02-21 13:19:00 +01:00
|
|
|
'suite' : ['slow'],
|
2018-08-15 18:25:14 +02:00
|
|
|
},
|
2018-09-20 18:51:18 +02:00
|
|
|
'gmenumodel' : {
|
|
|
|
'extra_sources' : extra_sources,
|
|
|
|
'suite' : ['slow'],
|
|
|
|
},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gnotification' : {
|
|
|
|
'extra_sources' : [extra_sources, 'gnotification-server.c'],
|
|
|
|
},
|
|
|
|
'gdbus-test-codegen-old' : {
|
|
|
|
'source' : 'gdbus-test-codegen.c',
|
2018-12-06 22:38:39 +01:00
|
|
|
'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
|
2018-08-15 18:25:14 +02:00
|
|
|
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
|
|
|
|
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
|
|
|
|
},
|
2020-01-27 11:11:46 +01:00
|
|
|
'gdbus-test-codegen-min-required-2-64' : {
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
'source' : 'gdbus-test-codegen.c',
|
2020-01-27 11:11:46 +01:00
|
|
|
'extra_sources' : [extra_sources, gdbus_test_codegen_generated_min_required_2_64, gdbus_test_codegen_generated_interface_info],
|
gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).
If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).
So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.
The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46
It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.
Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.
Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.
The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.
Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2019-11-25 20:51:13 +01:00
|
|
|
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_64'],
|
|
|
|
},
|
2018-08-15 18:25:14 +02:00
|
|
|
'gapplication' : {'extra_sources' : extra_sources},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-02-23 17:13:23 +01:00
|
|
|
|
2017-05-13 12:10:52 +02:00
|
|
|
if not glib_have_cocoa
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'dbus-appinfo' : {
|
|
|
|
'extra_sources' : extra_sources,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-05-13 12:10:52 +02:00
|
|
|
endif
|
2019-09-16 14:04:30 +02:00
|
|
|
|
|
|
|
fake_document_portal_generated = custom_target('fake-document-portal-generated',
|
|
|
|
input : ['../org.freedesktop.portal.Documents.xml'],
|
|
|
|
output : ['fake-document-portal-generated.h',
|
|
|
|
'fake-document-portal-generated.c'],
|
|
|
|
depend_files : gdbus_codegen_built_files,
|
|
|
|
command : [python, gdbus_codegen,
|
|
|
|
'--interface-prefix', 'org.freedesktop.portal.',
|
|
|
|
'--output-directory', '@OUTDIR@',
|
|
|
|
'--generate-c-code', 'fake-document-portal-generated',
|
|
|
|
'--c-namespace', 'Fake',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
|
|
|
test_extra_programs += {
|
|
|
|
'fake-document-portal' : {
|
|
|
|
'extra_sources': fake_document_portal_generated,
|
|
|
|
},
|
2021-01-16 08:03:34 +01:00
|
|
|
'fake-service-name' : {}
|
2019-09-16 14:04:30 +02:00
|
|
|
}
|
2017-02-24 10:46:36 +01:00
|
|
|
endif # have_dbus_daemon
|
|
|
|
|
|
|
|
# This test is currently unreliable
|
|
|
|
executable('gdbus-overflow', 'gdbus-overflow.c',
|
|
|
|
c_args : test_c_args,
|
2018-09-19 17:53:07 +02:00
|
|
|
dependencies : common_gio_tests_deps,
|
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install : installed_tests_enabled)
|
2017-02-24 10:46:36 +01:00
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-connection-flush' : {
|
|
|
|
'extra_sources' : ['test-io-stream.c', 'test-pipe-unix.c'],
|
|
|
|
},
|
|
|
|
'gdbus-non-socket' : {
|
|
|
|
'extra_sources' : ['gdbus-tests.c', 'test-io-stream.c', 'test-pipe-unix.c'],
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-02-24 10:46:36 +01:00
|
|
|
|
|
|
|
# Generate test.mo from de.po using msgfmt
|
|
|
|
msgfmt = find_program('msgfmt', required : false)
|
|
|
|
if msgfmt.found()
|
|
|
|
subdir('de/LC_MESSAGES')
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gsettings' : {
|
|
|
|
'extra_sources' : [test_mo],
|
|
|
|
'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
|
|
|
|
'-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
|
|
|
|
'install' : false,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-01-28 13:52:18 +01:00
|
|
|
endif
|
2017-02-24 10:46:36 +01:00
|
|
|
endif # unix
|
2016-03-07 12:13:24 +01:00
|
|
|
|
2017-02-23 17:13:23 +01:00
|
|
|
# Test programs buildable on Windows only
|
|
|
|
if host_machine.system() == 'windows'
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {'win32-streams' : {}}
|
2017-02-23 17:13:23 +01:00
|
|
|
endif
|
|
|
|
|
2016-12-29 03:39:44 +01:00
|
|
|
if cc.get_id() != 'msvc'
|
2018-09-24 16:25:37 +02:00
|
|
|
gio_tests += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'autoptr-gio' : {
|
|
|
|
'source' : 'autoptr.c',
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2016-03-07 12:13:24 +01:00
|
|
|
endif
|
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gio-du' : {'install' : false},
|
|
|
|
'echo-server' : {'install' : false},
|
|
|
|
'filter-cat' : {'install' : false},
|
|
|
|
'gapplication-example-actions' : {'install' : false},
|
|
|
|
'gapplication-example-cmdline' : {'install' : false},
|
|
|
|
'gapplication-example-cmdline2' : {'install' : false},
|
|
|
|
'gapplication-example-cmdline3' : {'install' : false},
|
|
|
|
'gapplication-example-cmdline4' : {'install' : false},
|
|
|
|
'gapplication-example-dbushooks' : {'install' : false},
|
|
|
|
'gapplication-example-open' : {'install' : false},
|
|
|
|
'gdbus-daemon' : {
|
|
|
|
'extra_sources' : gdbus_daemon_sources,
|
|
|
|
'install' : false,
|
|
|
|
},
|
|
|
|
'gdbus-example-export' : {'install' : false},
|
|
|
|
'gdbus-example-own-name' : {'install' : false},
|
|
|
|
'gdbus-example-peer' : {'install' : false},
|
|
|
|
'gdbus-example-proxy-subclass' : {'install' : false},
|
|
|
|
'gdbus-example-server' : {'install' : false},
|
|
|
|
'gdbus-example-subtree' : {'install' : false},
|
|
|
|
'gdbus-example-watch-name' : {'install' : false},
|
|
|
|
'gdbus-example-watch-proxy' : {'install' : false},
|
|
|
|
'httpd' : {'install' : false},
|
|
|
|
'proxy' : {'install' : false},
|
|
|
|
'resolver' : {'install' : false},
|
|
|
|
'send-data' : {'install' : false},
|
|
|
|
'socket-server' : {'install' : false},
|
|
|
|
'socket-client' : {
|
|
|
|
'extra_sources' : ['gtlsconsoleinteraction.c'],
|
|
|
|
'install' : false,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2016-03-07 12:13:24 +01:00
|
|
|
|
2019-07-09 20:57:54 +02:00
|
|
|
gdbus_example_objectmanager_sources = files(
|
|
|
|
'gdbus-example-objectmanager-client.c',
|
|
|
|
'gdbus-example-objectmanager-server.c',
|
|
|
|
)
|
|
|
|
|
2019-07-09 18:22:51 +02:00
|
|
|
if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs += {
|
2018-09-09 14:46:33 +02:00
|
|
|
# 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,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2018-09-09 14:46:33 +02:00
|
|
|
endif
|
|
|
|
|
2017-01-28 13:52:18 +01:00
|
|
|
if host_machine.system() != 'windows'
|
2018-09-24 16:25:37 +02:00
|
|
|
test_extra_programs += {
|
2018-08-15 18:25:14 +02:00
|
|
|
'gdbus-example-unix-fd-client' : {
|
|
|
|
'install' : false,
|
|
|
|
},
|
2018-09-24 16:25:37 +02:00
|
|
|
}
|
2017-01-28 13:52:18 +01:00
|
|
|
endif
|
|
|
|
|
2018-11-30 18:20:48 +01:00
|
|
|
appinfo_test_desktop_files = [
|
|
|
|
'appinfo-test-gnome.desktop',
|
|
|
|
'appinfo-test-notgnome.desktop',
|
|
|
|
'appinfo-test.desktop',
|
|
|
|
'appinfo-test2.desktop',
|
|
|
|
]
|
|
|
|
|
|
|
|
cdata = configuration_data()
|
|
|
|
if installed_tests_enabled
|
|
|
|
cdata.set('installed_tests_dir', installed_tests_execdir)
|
|
|
|
else
|
|
|
|
cdata.set('installed_tests_dir', meson.current_build_dir())
|
|
|
|
endif
|
|
|
|
|
|
|
|
foreach appinfo_test_desktop_file : appinfo_test_desktop_files
|
2019-06-17 17:52:36 +02:00
|
|
|
if installed_tests_enabled
|
|
|
|
configure_file(
|
|
|
|
input: appinfo_test_desktop_file + '.in',
|
|
|
|
output: appinfo_test_desktop_file,
|
|
|
|
install_dir: installed_tests_execdir,
|
|
|
|
configuration: cdata,
|
|
|
|
)
|
|
|
|
else
|
|
|
|
configure_file(
|
|
|
|
input: appinfo_test_desktop_file + '.in',
|
|
|
|
output: appinfo_test_desktop_file,
|
|
|
|
configuration: cdata,
|
|
|
|
)
|
|
|
|
endif
|
2018-11-30 18:20:48 +01:00
|
|
|
endforeach
|
|
|
|
|
2018-09-19 17:53:07 +02:00
|
|
|
if installed_tests_enabled
|
|
|
|
install_data(
|
|
|
|
'contexts.c',
|
|
|
|
'g-icon.c',
|
|
|
|
'appinfo-test-actions.desktop',
|
2018-12-14 14:05:17 +01:00
|
|
|
'appinfo-test-static.desktop',
|
2018-09-19 17:53:07 +02:00
|
|
|
'file.c',
|
|
|
|
'org.gtk.test.dbusappinfo.desktop',
|
2019-09-16 16:30:10 +02:00
|
|
|
'org.gtk.test.dbusappinfo.flatpak.desktop',
|
2019-02-11 11:21:13 +01:00
|
|
|
'test1.overlay',
|
2018-09-19 17:53:07 +02:00
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
)
|
|
|
|
install_subdir('x-content', install_dir : installed_tests_execdir)
|
|
|
|
install_subdir('desktop-files', install_dir : installed_tests_execdir)
|
|
|
|
install_subdir('thumbnails', install_dir : installed_tests_execdir)
|
|
|
|
install_subdir('cert-tests', install_dir : installed_tests_execdir)
|
2018-09-26 16:56:10 +02:00
|
|
|
|
|
|
|
cdata = configuration_data()
|
|
|
|
cdata.set('installed_tests_dir', installed_tests_execdir)
|
|
|
|
cdata.set('program', 'static-link.py ' + glib_pkgconfigreldir)
|
|
|
|
configure_file(
|
|
|
|
input: installed_tests_template,
|
|
|
|
output: 'static-link.test',
|
|
|
|
install_dir: installed_tests_metadir,
|
|
|
|
configuration: cdata
|
|
|
|
)
|
|
|
|
install_subdir('static-link', install_dir : installed_tests_execdir)
|
|
|
|
install_data('static-link.py', install_dir : installed_tests_execdir)
|
2018-09-19 17:53:07 +02:00
|
|
|
|
2021-08-10 10:58:53 +02:00
|
|
|
monitor_tests = [
|
2020-02-27 21:13:19 +01:00
|
|
|
'memory-monitor-dbus',
|
|
|
|
'memory-monitor-portal',
|
2021-08-10 10:58:53 +02:00
|
|
|
'power-profile-monitor-dbus',
|
|
|
|
'power-profile-monitor-portal'
|
2020-02-27 21:13:19 +01:00
|
|
|
]
|
2019-11-15 12:24:57 +01:00
|
|
|
|
2021-08-10 10:58:53 +02:00
|
|
|
foreach monitor_test : monitor_tests
|
2020-02-27 21:13:19 +01:00
|
|
|
cdata = configuration_data()
|
|
|
|
cdata.set('installed_tests_dir', installed_tests_execdir)
|
2021-08-10 10:58:53 +02:00
|
|
|
cdata.set('program', monitor_test + '.py')
|
2020-04-07 16:45:06 +02:00
|
|
|
cdata.set('env', '')
|
2020-02-27 21:13:19 +01:00
|
|
|
configure_file(
|
2020-04-07 16:45:06 +02:00
|
|
|
input: installed_tests_template_tap,
|
2021-08-10 10:58:53 +02:00
|
|
|
output: monitor_test + '.test',
|
2020-02-27 21:13:19 +01:00
|
|
|
install_dir: installed_tests_metadir,
|
|
|
|
configuration: cdata
|
|
|
|
)
|
|
|
|
cdata = configuration_data()
|
|
|
|
cdata.set('libexecdir', join_paths(glib_prefix, get_option('libexecdir')))
|
|
|
|
configure_file(
|
2021-08-10 10:58:53 +02:00
|
|
|
input: monitor_test + '.py.in',
|
|
|
|
output: monitor_test + '.py',
|
2020-02-27 21:13:19 +01:00
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
configuration: cdata,
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endif
|
2019-11-15 12:24:57 +01:00
|
|
|
|
2017-02-23 01:40:45 +01:00
|
|
|
if not meson.is_cross_build() or meson.has_exe_wrapper()
|
|
|
|
|
|
|
|
plugin_resources_c = custom_target('plugin-resources.c',
|
|
|
|
input : 'test4.gresource.xml',
|
|
|
|
output : 'plugin-resources.c',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--generate-source',
|
|
|
|
'--c-name', '_g_plugin',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
2018-09-19 17:53:07 +02:00
|
|
|
shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
|
2018-09-09 14:46:33 +02:00
|
|
|
link_args : export_dynamic_ldflags,
|
2018-09-19 17:53:07 +02:00
|
|
|
dependencies : common_gio_tests_deps,
|
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install : installed_tests_enabled
|
|
|
|
)
|
2017-02-23 01:40:45 +01:00
|
|
|
|
2018-11-30 10:49:44 +01:00
|
|
|
# referenced by test2.gresource.xml
|
|
|
|
big_test_resource = custom_target(
|
|
|
|
'gresource-big-test.txt',
|
|
|
|
input : ['gen-big-test-resource.py'],
|
|
|
|
output : ['gresource-big-test.txt'],
|
|
|
|
command : [python, '@INPUT0@', '@OUTPUT@'])
|
|
|
|
|
2017-02-23 01:40:45 +01:00
|
|
|
test_gresource = custom_target('test.gresource',
|
|
|
|
input : 'test.gresource.xml',
|
|
|
|
output : 'test.gresource',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--sourcedir=' + meson.current_build_dir(),
|
2018-09-19 17:53:07 +02:00
|
|
|
'@INPUT@'],
|
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install : installed_tests_enabled)
|
2017-02-23 01:40:45 +01:00
|
|
|
|
|
|
|
test_resources2_c = custom_target('test_resources2.c',
|
|
|
|
input : 'test3.gresource.xml',
|
|
|
|
output : 'test_resources2.c',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--generate',
|
|
|
|
'--c-name', '_g_test2',
|
|
|
|
'--manual-register',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
|
|
|
test_resources2_h = custom_target('test_resources2.h',
|
|
|
|
input : 'test3.gresource.xml',
|
|
|
|
output : 'test_resources2.h',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--generate',
|
|
|
|
'--c-name', '_g_test2',
|
|
|
|
'--manual-register',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
|
|
|
test_resources_c = custom_target('test_resources.c',
|
|
|
|
input : 'test2.gresource.xml',
|
2018-11-30 10:49:44 +01:00
|
|
|
depends : big_test_resource,
|
2017-02-23 01:40:45 +01:00
|
|
|
output : 'test_resources.c',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
2018-11-30 10:49:44 +01:00
|
|
|
'--sourcedir=' + meson.current_build_dir(),
|
2017-02-23 01:40:45 +01:00
|
|
|
'--generate-source',
|
|
|
|
'--c-name', '_g_test1',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
2019-02-20 11:38:29 +01:00
|
|
|
digit_test_resources_c = custom_target('digit_test_resources.c',
|
|
|
|
input : '111_digit_test.gresource.xml',
|
|
|
|
output : 'digit_test_resources.c',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--sourcedir=' + meson.current_build_dir(),
|
|
|
|
'--generate-source',
|
|
|
|
'--manual-register',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
|
|
|
digit_test_resources_h = custom_target('digit_test_resources.h',
|
|
|
|
input : '111_digit_test.gresource.xml',
|
|
|
|
output : 'digit_test_resources.h',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--generate',
|
|
|
|
'--manual-register',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
2017-02-23 01:40:45 +01:00
|
|
|
# referenced by test.gresource.xml
|
|
|
|
test_generated_txt = configure_file(input : 'test1.txt',
|
|
|
|
output : 'test-generated.txt',
|
2018-07-03 16:47:52 +02:00
|
|
|
copy : true,
|
2019-06-17 17:52:36 +02:00
|
|
|
)
|
2017-02-23 01:40:45 +01:00
|
|
|
|
2019-04-03 17:45:58 +02:00
|
|
|
resources_extra_sources = [
|
|
|
|
test_gresource,
|
|
|
|
test_resources_c,
|
|
|
|
test_resources2_c,
|
|
|
|
test_resources2_h,
|
|
|
|
digit_test_resources_c,
|
|
|
|
digit_test_resources_h,
|
|
|
|
]
|
|
|
|
|
2019-04-12 15:13:58 +02:00
|
|
|
# Create object file containing resource data for testing the --external-data
|
2021-06-14 15:48:14 +02:00
|
|
|
# option. Currently only GNU ld and objcopy, or (as of 2019) LLVM ld and
|
|
|
|
# objcopy, support the right options.
|
2019-11-20 21:32:33 +01:00
|
|
|
objcopy_supports_add_symbol = false
|
2019-10-28 13:08:48 +01:00
|
|
|
objcopy = find_program('objcopy', required : false)
|
2019-11-20 21:32:33 +01:00
|
|
|
if objcopy.found()
|
2021-11-24 13:01:39 +01:00
|
|
|
# FIXME: This should be `check: true` because we never really expect
|
|
|
|
# `objcopy --help` to fail, given that `objcopy` exists. However, it does
|
|
|
|
# fail on FreeBSD because ELF Tool Chain has
|
|
|
|
# [a bug](https://sourceforge.net/p/elftoolchain/code/3950/).
|
|
|
|
# This can be changed back to `check: true` once our CI uses a FreeBSD
|
|
|
|
# version which includes the fix.
|
|
|
|
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2360#note_1318608
|
|
|
|
objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
|
2019-11-20 21:32:33 +01:00
|
|
|
endif
|
|
|
|
|
2019-11-04 11:24:15 +01:00
|
|
|
ld = find_program('ld', required : false)
|
2019-10-28 13:08:48 +01:00
|
|
|
|
2021-06-14 15:48:14 +02:00
|
|
|
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
2018-09-09 18:31:38 +02:00
|
|
|
test_gresource_binary = custom_target('test5.gresource',
|
|
|
|
input : 'test5.gresource.xml',
|
|
|
|
output : 'test5.gresource',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--sourcedir=' + meson.current_build_dir(),
|
|
|
|
'@INPUT@'],
|
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install : installed_tests_enabled)
|
|
|
|
|
2019-04-03 17:45:05 +02:00
|
|
|
# Create resource data file
|
2018-09-09 18:31:38 +02:00
|
|
|
test_resources_binary_c = custom_target('test_resources_binary.c',
|
|
|
|
input : 'test5.gresource.xml',
|
|
|
|
output : 'test_resources_binary.c',
|
|
|
|
command : [glib_compile_resources,
|
|
|
|
'--target=@OUTPUT@',
|
|
|
|
'--sourcedir=' + meson.current_source_dir(),
|
|
|
|
'--sourcedir=' + meson.current_build_dir(),
|
|
|
|
'--generate-source',
|
|
|
|
'--external-data',
|
|
|
|
'--c-name', '_g_binary_test1',
|
|
|
|
'@INPUT@'])
|
|
|
|
|
2019-04-03 17:45:05 +02:00
|
|
|
# Create object file containing resource data
|
2018-09-09 18:31:38 +02:00
|
|
|
test_resources_binary = custom_target('test_resources.o',
|
|
|
|
input : test_gresource_binary,
|
|
|
|
output : 'test_resources.o',
|
2019-11-04 11:24:15 +01:00
|
|
|
command : [ld,
|
2018-09-09 18:31:38 +02:00
|
|
|
'-r',
|
|
|
|
'-b','binary',
|
|
|
|
'@INPUT@',
|
|
|
|
'-o','@OUTPUT@'])
|
|
|
|
|
2019-04-03 17:45:05 +02:00
|
|
|
# Rename symbol to match the one in the C file
|
2022-01-06 09:18:37 +01:00
|
|
|
if cc.get_id() == 'gcc' and host_system == 'windows'
|
|
|
|
underscore = '_'
|
|
|
|
else
|
|
|
|
underscore = ''
|
|
|
|
endif
|
2018-09-09 18:31:38 +02:00
|
|
|
test_resources_binary2 = custom_target('test_resources2.o',
|
|
|
|
input : test_resources_binary,
|
|
|
|
output : 'test_resources2.o',
|
2019-10-28 13:08:48 +01:00
|
|
|
command : [objcopy,
|
2022-01-06 09:18:37 +01:00
|
|
|
'--add-symbol', underscore + '_g_binary_test1_resource_data=.data:0',
|
2018-09-09 18:31:38 +02:00
|
|
|
'@INPUT@',
|
|
|
|
'@OUTPUT@'])
|
|
|
|
|
2019-04-03 17:45:58 +02:00
|
|
|
resources_extra_sources += [
|
|
|
|
test_resources_binary_c,
|
|
|
|
test_resources_binary2,
|
|
|
|
]
|
2018-09-09 18:31:38 +02:00
|
|
|
endif
|
2019-04-03 17:45:58 +02:00
|
|
|
|
|
|
|
gio_tests += {
|
|
|
|
'resources' : {
|
|
|
|
'extra_sources' : resources_extra_sources,
|
|
|
|
},
|
|
|
|
}
|
2017-02-23 01:40:45 +01:00
|
|
|
endif
|
2016-12-21 03:16:30 +01:00
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
foreach test_name, extra_args : gio_tests
|
|
|
|
source = extra_args.get('source', test_name + '.c')
|
|
|
|
extra_sources = extra_args.get('extra_sources', [])
|
|
|
|
install = installed_tests_enabled and extra_args.get('install', true)
|
2019-02-12 12:29:10 +01:00
|
|
|
installed_tests_env = extra_args.get('installed_tests_env', {})
|
2018-09-24 16:25:37 +02:00
|
|
|
|
|
|
|
if install
|
|
|
|
test_conf = configuration_data()
|
|
|
|
test_conf.set('installed_tests_dir', installed_tests_execdir)
|
|
|
|
test_conf.set('program', test_name)
|
2019-02-12 12:29:10 +01:00
|
|
|
test_env_override = ''
|
|
|
|
if installed_tests_env != {}
|
|
|
|
envs = []
|
|
|
|
foreach var, value : installed_tests_env
|
|
|
|
envs += '@0@=@1@'.format(var, value)
|
|
|
|
endforeach
|
|
|
|
test_env_override = '@0@ @1@ '.format(env_program.path(), ' '.join(envs))
|
|
|
|
endif
|
|
|
|
test_conf.set('env', test_env_override)
|
2018-09-24 16:25:37 +02:00
|
|
|
configure_file(
|
|
|
|
input: installed_tests_template_tap,
|
|
|
|
output: test_name + '.test',
|
|
|
|
install_dir: installed_tests_metadir,
|
|
|
|
configuration: test_conf
|
2018-08-15 18:25:14 +02:00
|
|
|
)
|
2018-09-24 16:25:37 +02:00
|
|
|
endif
|
2018-08-15 18:25:14 +02:00
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
exe = executable(test_name, [source, extra_sources],
|
|
|
|
c_args : test_c_args + extra_args.get('c_args', []),
|
|
|
|
dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
|
2018-09-24 19:32:08 +02:00
|
|
|
install_rpath : extra_args.get('install_rpath', ''),
|
2018-09-24 16:25:37 +02:00
|
|
|
install_dir: installed_tests_execdir,
|
|
|
|
install: install,
|
|
|
|
)
|
|
|
|
|
|
|
|
suite = ['gio'] + extra_args.get('suite', [])
|
2018-11-01 10:35:17 +01:00
|
|
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
2018-11-16 19:54:07 +01:00
|
|
|
local_test_env = test_env
|
|
|
|
|
|
|
|
foreach var, value : extra_args.get('env', {})
|
|
|
|
local_test_env.append(var, value)
|
|
|
|
endforeach
|
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
test(test_name, exe,
|
2018-11-16 19:54:07 +01:00
|
|
|
env : local_test_env,
|
2018-09-24 16:25:37 +02:00
|
|
|
timeout : timeout,
|
|
|
|
suite : suite,
|
|
|
|
is_parallel : extra_args.get('is_parallel', true),
|
2018-11-16 19:54:07 +01:00
|
|
|
depends : extra_args.get('depends', []),
|
2018-09-24 16:25:37 +02:00
|
|
|
)
|
2018-08-15 18:25:14 +02:00
|
|
|
endforeach
|
|
|
|
|
2018-09-24 16:25:37 +02:00
|
|
|
foreach program_name, extra_args : test_extra_programs
|
|
|
|
source = extra_args.get('source', program_name + '.c')
|
|
|
|
extra_sources = extra_args.get('extra_sources', [])
|
|
|
|
install = installed_tests_enabled and extra_args.get('install', true)
|
|
|
|
executable(program_name, [source, extra_sources],
|
|
|
|
c_args : test_c_args,
|
|
|
|
dependencies : common_gio_tests_deps + extra_args.get('dependencies', []),
|
|
|
|
install_dir : installed_tests_execdir,
|
|
|
|
install : install,
|
|
|
|
)
|
2018-08-15 18:25:14 +02:00
|
|
|
endforeach
|
|
|
|
|
2019-12-02 15:05:22 +01:00
|
|
|
foreach test_name : python_tests
|
|
|
|
test(
|
|
|
|
test_name,
|
|
|
|
python,
|
|
|
|
args: ['-B', files(test_name)],
|
|
|
|
env: test_env,
|
|
|
|
suite: ['gio', 'no-valgrind'],
|
|
|
|
)
|
|
|
|
|
|
|
|
if installed_tests_enabled
|
|
|
|
install_data(
|
|
|
|
files(test_name),
|
|
|
|
install_dir: installed_tests_execdir,
|
|
|
|
install_mode: 'rwxr-xr-x',
|
|
|
|
)
|
|
|
|
|
|
|
|
test_conf = configuration_data()
|
|
|
|
test_conf.set('installed_tests_dir', installed_tests_execdir)
|
|
|
|
test_conf.set('program', test_name)
|
|
|
|
test_conf.set('env', '')
|
|
|
|
configure_file(
|
|
|
|
input: installed_tests_template_tap,
|
|
|
|
output: test_name + '.test',
|
|
|
|
install_dir: installed_tests_metadir,
|
|
|
|
configuration: test_conf,
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
# TAP test runner for Python tests
|
|
|
|
if installed_tests_enabled
|
|
|
|
install_data(
|
|
|
|
files('taptestrunner.py'),
|
|
|
|
install_dir: installed_tests_execdir,
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2019-09-16 14:04:30 +02:00
|
|
|
subdir('services')
|
2016-03-07 12:13:24 +01:00
|
|
|
subdir('modules')
|