test_c_args = [
'-DG_LOG_DOMAIN="GLib-GIO"',
- '-DTEST_SERVICES="@0@/gio/tests/services"'.format(meson.build_root()),
'-DGLIB_MKENUMS="@0@"'.format(glib_mkenums),
'-DGLIB_COMPILE_SCHEMAS="@0@"'.format(glib_compile_schemas.full_path()),
+ '-UG_DISABLE_ASSERT',
]
+# 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"'''
+ .format(libutil_name), check: false).stdout().strip().split('\n')
+
+ 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'
+
if host_machine.system() == 'windows'
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
endif
command: [gengiotypefuncs_prog, '@OUTPUT@', '@INPUT@'])
# Test programs buildable on all platforms
-# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
-# that supports '+=' operator on dictionnaries.
-gio_tests = [{
- 'appmonitor' : {},
+gio_tests = {
+ 'appmonitor' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
'async-close-output-stream' : {},
'async-splice-output-stream' : {},
'buffered-input-stream' : {},
'buffered-output-stream' : {},
'cancellable' : {},
'contexts' : {},
- 'contenttype' : {},
+ 'contenttype' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 / https://gitlab.gnome.org/GNOME/glib/-/issues/1251
+ 'should_fail' : host_system == 'darwin',
+ },
'converter-stream' : {},
'credentials' : {},
+ 'cxx' : {
+ 'source' : ['cxx.cpp'],
+ },
'data-input-stream' : {},
'data-output-stream' : {},
- 'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
'fileattributematcher' : {},
'filter-streams' : {},
- 'giomodule' : {},
- 'gsubprocess' : {},
+ 'giomodule' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
+ 'gsubprocess' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
'g-file' : {},
- 'g-file-info' : {},
+ 'g-file-info' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
'g-icon' : {},
'gdbus-addresses' : {},
'gdbus-message' : {},
'inet-address' : {},
'io-stream' : {},
'memory-input-stream' : {},
+ 'memory-monitor' : {},
'memory-output-stream' : {},
- 'monitor' : {},
'mount-operation' : {},
- 'network-address' : {},
+ 'network-address' : {'extra_sources': ['mock-resolver.c']},
'network-monitor' : {},
'network-monitor-race' : {},
'permission' : {},
- 'pollable' : {},
+ 'pollable' : {'dependencies' : [libdl_dep]},
+ 'power-profile-monitor' : {},
'proxy-test' : {},
'readwrite' : {},
'simple-async-result' : {},
'simple-proxy' : {},
'sleepy-stream' : {},
- 'socket' : {},
+ 'socket' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
'socket-listener' : {},
'socket-service' : {},
'srvtarget' : {},
'vfs' : {},
'volumemonitor' : {},
'glistmodel' : {},
- 'testfilemonitor' : {'suite' : ['slow']},
+ 'testfilemonitor' : {'suite' : ['slow', 'flaky']},
'thumbnail-verification' : {},
'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']},
'tls-interaction' : {'extra_sources' : ['gtesttlsbackend.c']},
-}]
+ 'tls-database' : {'extra_sources' : ['gtesttlsbackend.c']},
+ 'tls-bindings' : {'extra_sources' : ['gtesttlsbackend.c']},
+ 'gdbus-address-get-session' : {
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
+ },
+ 'win32-appinfo' : {},
+}
-# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
-# that supports '+=' operator on dictionnaries.
-test_extra_programs = [{
+test_extra_programs = {
'gdbus-connection-flush-helper' : {},
'gdbus-testserver' : {},
'gsubprocess-testprog' : {},
-}]
+}
+
+python_tests = [
+ 'codegen.py',
+]
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', '')
-test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop')
# 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')
if not dbus1_dep.found()
- if cc.get_id() == 'msvc'
+ if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
# 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.
- if buildtype == 'debug'
+ if vs_crt == 'debug'
dbus1_dep = cc.find_library('dbus-1d', required : false)
else
dbus1_dep = cc.find_library('dbus-1', required : false)
if dbus1_dep.found()
glib_conf.set('HAVE_DBUS1', 1)
- gio_tests += [{
+ gio_tests += {
'gdbus-serialization' : {
'extra_sources' : ['gdbus-tests.c'],
'dependencies' : [dbus1_dep],
- }
- }]
+ },
+ 'gdbus-server-auth' : {
+ 'dependencies' : [dbus1_dep],
+ },
+ }
+else
+ # We can build a cut-down version of this test without libdbus
+ gio_tests += {
+ 'gdbus-server-auth' : {},
+ }
+endif
+
+have_dbus_daemon = find_program('dbus-daemon', required : false).found()
+if have_dbus_daemon
+ gio_tests += {
+ 'debugcontroller' : {},
+ 'defaultvalue' : {'extra_sources' : [giotypefuncs_inc]},
+ }
endif
# Test programs buildable on UNIX only
if host_machine.system() != 'windows'
- gio_tests += [{
+ gio_tests += {
'file' : {},
'gdbus-peer' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
- 'install_rpath' : installed_tests_execdir
+ 'install_rpath' : installed_tests_execdir,
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
},
'gdbus-peer-object-manager' : {},
'live-g-file' : {},
+ 'resolver-parsing' : {'dependencies' : [network_libs]},
'socket-address' : {},
'stream-rw_all' : {},
'unix-fd' : {},
'g-file-info-filesystem-readonly' : {},
'gschema-compile' : {'install' : false},
'trash' : {},
- }]
+ }
+
+ # LD_PRELOAD modules don't work so well with AddressSanitizer
+ if have_rtld_next and get_option('b_sanitize') == 'none'
+ gio_tests += {
+ 'gsocketclient-slow' : {
+ 'depends' : [
+ shared_library('slow-connect-preload',
+ 'slow-connect-preload.c',
+ name_prefix : '',
+ dependencies: libdl_dep,
+ 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
# Uninstalled because of the check-for-executable logic in DesktopAppInfo
# unable to find the installed executable
if not glib_have_cocoa
- gio_tests += [{
+ gio_tests += {
'appinfo' : {
'install' : false,
- 'is_parallel' : false,
},
'desktop-app-info' : {
'install' : false,
- 'is_parallel' : false,
},
- }]
+ }
endif
- test_extra_programs += [{
+ test_extra_programs += {
'basic-application' : {},
'dbus-launch' : {},
'appinfo-test' : {},
- }]
+ }
if not glib_have_cocoa
- test_extra_programs += [{
+ test_extra_programs += {
'apps' : {},
- }]
- gio_tests += [{
+ }
+ gio_tests += {
'mimeapps' : {},
- }]
+ }
endif
- # Test programs that need to bring up a session bus (requires dbus-daemon)
- have_dbus_daemon = find_program('dbus-daemon', required : false).found()
if have_dbus_daemon
annotate_args = [
'--annotate', 'org.project.Bar', 'Key1', 'Value1',
'--generate-docbook', 'gdbus-test-codegen-generated-doc',
annotate_args,
'@INPUT@'])
-
+ # 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',
+ input : ['test-codegen.xml'],
+ output : ['gdbus-test-codegen-generated-min-required-2-64.h',
+ 'gdbus-test-codegen-generated-min-required-2-64.c'],
+ depend_files : gdbus_codegen_built_files,
+ command : [python, gdbus_codegen,
+ '--glib-min-required', '2.64',
+ '--interface-prefix', 'org.project.',
+ '--output-directory', '@OUTDIR@',
+ '--generate-c-code', 'gdbus-test-codegen-generated-min-required-2-64',
+ '--c-generate-object-manager',
+ '--c-generate-autocleanup', 'all',
+ '--c-namespace', 'Foo_iGen',
+ '--generate-docbook', 'gdbus-test-codegen-generated-doc',
+ annotate_args,
+ '@INPUT@'])
gdbus_test_codegen_generated_interface_info = [
custom_target('gdbus-test-codegen-generated-interface-info-h',
input : ['test-codegen.xml'],
extra_sources = ['gdbus-sessionbus.c', 'gdbus-tests.c']
- gio_tests += [{
+ gio_tests += {
'actions' : {
'extra_sources' : extra_sources,
'suite' : ['slow'],
'suite' : ['slow'],
},
'gdbus-introspection' : {'extra_sources' : extra_sources},
+ 'gdbus-method-invocation' : {'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],
},
+ 'gdbus-proxy-unique-name' : {'extra_sources' : extra_sources},
'gdbus-proxy-well-known-name' : {'extra_sources' : extra_sources},
'gdbus-test-codegen' : {
'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
+ 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
},
'gdbus-threading' : {
'extra_sources' : extra_sources,
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36',
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36'],
},
+ 'gdbus-test-codegen-min-required-2-64' : {
+ 'source' : 'gdbus-test-codegen.c',
+ 'extra_sources' : [extra_sources, gdbus_test_codegen_generated_min_required_2_64, gdbus_test_codegen_generated_interface_info],
+ 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_64'],
+ },
'gapplication' : {'extra_sources' : extra_sources},
- 'gdbus-unix-addresses' : {},
- }]
+ }
if not glib_have_cocoa
- gio_tests += [{
+ gio_tests += {
'dbus-appinfo' : {
'extra_sources' : extra_sources,
},
- }]
+ }
endif
+
+ 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,
+ },
+ 'fake-service-name' : {}
+ }
endif # have_dbus_daemon
# This test is currently unreliable
install_dir : installed_tests_execdir,
install : installed_tests_enabled)
- gio_tests += [{
+ gio_tests += {
'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'],
},
- }]
+ }
# Generate test.mo from de.po using msgfmt
msgfmt = find_program('msgfmt', required : false)
if msgfmt.found()
subdir('de/LC_MESSAGES')
- gio_tests += [{
+ gio_tests += {
'gsettings' : {
'extra_sources' : [test_mo],
'c_args' : ['-DSRCDIR="@0@"'.format(meson.current_source_dir()),
'-DTEST_LOCALE_PATH="@0@"'.format(test_mo_dir)],
'install' : false,
},
- }]
+ }
endif
endif # unix
# Test programs buildable on Windows only
if host_machine.system() == 'windows'
- gio_tests += [{'win32-streams' : {}}]
+ gio_tests += {'win32-streams' : {}}
endif
if cc.get_id() != 'msvc'
- gio_tests += [{
+ gio_tests += {
'autoptr-gio' : {
'source' : 'autoptr.c',
},
- }]
+ }
endif
-test_extra_programs += [{
+test_extra_programs += {
'gio-du' : {'install' : false},
'echo-server' : {'install' : false},
'filter-cat' : {'install' : false},
'extra_sources' : ['gtlsconsoleinteraction.c'],
'install' : false,
},
-}]
+}
-if cc.get_id() != 'msvc'
- test_extra_programs += [{
+gdbus_example_objectmanager_sources = files(
+ 'gdbus-example-objectmanager-client.c',
+ 'gdbus-example-objectmanager-server.c',
+)
+
+if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
+ 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,
},
- }]
+ }
endif
if host_machine.system() != 'windows'
- test_extra_programs += [{
+ test_extra_programs += {
'gdbus-example-unix-fd-client' : {
'install' : false,
},
- }]
+ }
endif
+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
+ 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
+endforeach
+
if installed_tests_enabled
install_data(
'contexts.c',
'g-icon.c',
'appinfo-test-actions.desktop',
- 'appinfo-test-gnome.desktop',
- 'appinfo-test-notgnome.desktop',
- 'appinfo-test.desktop',
- 'appinfo-test2.desktop',
+ 'appinfo-test-static.desktop',
'file.c',
'org.gtk.test.dbusappinfo.desktop',
+ 'org.gtk.test.dbusappinfo.flatpak.desktop',
+ 'test1.overlay',
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)
+
+ 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)
+
+ monitor_tests = [
+ 'memory-monitor-dbus',
+ 'memory-monitor-portal',
+ 'power-profile-monitor-dbus',
+ 'power-profile-monitor-portal'
+ ]
+
+ foreach monitor_test : monitor_tests
+ cdata = configuration_data()
+ cdata.set('installed_tests_dir', installed_tests_execdir)
+ cdata.set('program', monitor_test + '.py')
+ cdata.set('env', '')
+ configure_file(
+ input: installed_tests_template_tap,
+ output: monitor_test + '.test',
+ install_dir: installed_tests_metadir,
+ configuration: cdata
+ )
+ cdata = configuration_data()
+ cdata.set('libexecdir', join_paths(glib_prefix, get_option('libexecdir')))
+ configure_file(
+ input: monitor_test + '.py.in',
+ output: monitor_test + '.py',
+ install_dir : installed_tests_execdir,
+ configuration: cdata,
+ )
+ endforeach
endif
if not meson.is_cross_build() or meson.has_exe_wrapper()
+ compiler_type = '--compiler=@0@'.format(cc.get_id())
+
plugin_resources_c = custom_target('plugin-resources.c',
input : 'test4.gresource.xml',
output : 'plugin-resources.c',
command : [glib_compile_resources,
+ compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
+ '--internal',
'--generate-source',
'--c-name', '_g_plugin',
'@INPUT@'])
install : installed_tests_enabled
)
+ # 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@'])
+
test_gresource = custom_target('test.gresource',
input : 'test.gresource.xml',
output : 'test.gresource',
command : [glib_compile_resources,
+ compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
+ '--internal',
'@INPUT@'],
install_dir : installed_tests_execdir,
install : installed_tests_enabled)
input : 'test3.gresource.xml',
output : 'test_resources2.c',
command : [glib_compile_resources,
+ compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
+ '--internal',
'--generate',
'--c-name', '_g_test2',
'--manual-register',
input : 'test3.gresource.xml',
output : 'test_resources2.h',
command : [glib_compile_resources,
+ compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
+ '--internal',
'--generate',
'--c-name', '_g_test2',
'--manual-register',
test_resources_c = custom_target('test_resources.c',
input : 'test2.gresource.xml',
+ depends : big_test_resource,
output : 'test_resources.c',
command : [glib_compile_resources,
+ compiler_type,
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+ '--internal',
'--generate-source',
'--c-name', '_g_test1',
'@INPUT@'])
+ 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,
+ compiler_type,
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+ '--internal',
+ '--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,
+ compiler_type,
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--internal',
+ '--generate',
+ '--manual-register',
+ '@INPUT@'])
+
# referenced by test.gresource.xml
test_generated_txt = configure_file(input : 'test1.txt',
output : 'test-generated.txt',
copy : true,
- install : false)
+ )
+
+ resources_extra_sources = [
+ test_gresource,
+ test_resources_c,
+ test_resources2_c,
+ test_resources2_h,
+ digit_test_resources_c,
+ digit_test_resources_h,
+ ]
+
+ # Create object file containing resource data for testing the --external-data
+ # option. Currently only GNU ld and objcopy, or (as of 2019) LLVM ld and
+ # objcopy, support the right options.
+ objcopy_supports_add_symbol = false
+ objcopy = find_program('objcopy', required : false)
+ if objcopy.found()
+ # 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')
+ endif
- gio_tests += [{
+ ld = find_program('ld', required : false)
+
+ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
+ test_gresource_binary = custom_target('test5.gresource',
+ input : 'test5.gresource.xml',
+ output : 'test5.gresource',
+ command : [glib_compile_resources,
+ compiler_type,
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+ '--internal',
+ '@INPUT@'],
+ install_dir : installed_tests_execdir,
+ install : installed_tests_enabled)
+
+ # Create resource data file
+ test_resources_binary_c = custom_target('test_resources_binary.c',
+ input : 'test5.gresource.xml',
+ output : 'test_resources_binary.c',
+ command : [glib_compile_resources,
+ compiler_type,
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+ '--internal',
+ '--generate-source',
+ '--external-data',
+ '--c-name', '_g_binary_test1',
+ '@INPUT@'])
+
+ # Create object file containing resource data
+ test_resources_binary = custom_target('test_resources.o',
+ input : test_gresource_binary,
+ output : 'test_resources.o',
+ command : [ld,
+ '-z', 'noexecstack',
+ '-r',
+ '-b','binary',
+ '@INPUT@',
+ '-o','@OUTPUT@'])
+
+ # Rename symbol to match the one in the C file
+ if cc.get_id() == 'gcc' and host_system == 'windows'
+ underscore = '_'
+ else
+ underscore = ''
+ endif
+ test_resources_binary2 = custom_target('test_resources2.o',
+ input : test_resources_binary,
+ output : 'test_resources2.o',
+ command : [objcopy,
+ '--strip-all',
+ '--add-symbol', underscore + '_g_binary_test1_resource_data=.data:0',
+ '@INPUT@',
+ '@OUTPUT@'])
+
+ resources_extra_sources += [
+ test_resources_binary_c,
+ test_resources_binary2,
+ ]
+ endif
+
+ gio_tests += {
'resources' : {
- 'extra_sources' : [test_gresource, test_resources_c, test_resources2_c,
- test_resources2_h],
+ 'extra_sources' : resources_extra_sources,
+ # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
+ 'should_fail' : host_system == 'darwin',
},
- }]
+ }
endif
-foreach test_dict : gio_tests
- foreach test_name, extra_args : test_dict
- 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)
-
- if install
- test_conf = configuration_data()
- test_conf.set('installed_tests_dir', installed_tests_execdir)
- test_conf.set('program', test_name)
- configure_file(
- input: installed_tests_template_tap,
- output: test_name + '.test',
- install_dir: installed_tests_metadir,
- configuration: test_conf
- )
+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)
+ installed_tests_env = extra_args.get('installed_tests_env', {})
+
+ if install
+ test_conf = configuration_data()
+ test_conf.set('installed_tests_dir', installed_tests_execdir)
+ test_conf.set('program', test_name)
+ 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)
+ configure_file(
+ input: installed_tests_template_tap,
+ output: test_name + '.test',
+ install_dir: installed_tests_metadir,
+ configuration: test_conf
+ )
+ endif
+
+ 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', []),
+ install_rpath : extra_args.get('install_rpath', ''),
+ install_dir: installed_tests_execdir,
+ install: install,
+ )
- exe = executable(test_name, [source, extra_sources],
- c_args : test_c_args + extra_args.get('c_args', []),
+ suite = ['gio'] + extra_args.get('suite', [])
+ timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
+ local_test_env = test_env
+
+ foreach var, value : extra_args.get('env', {})
+ local_test_env.append(var, value)
+ endforeach
+
+ test(test_name, exe,
+ env : local_test_env,
+ timeout : timeout,
+ suite : suite,
+ is_parallel : extra_args.get('is_parallel', true),
+ depends : extra_args.get('depends', []),
+ should_fail : extra_args.get('should_fail', false),
+ )
+endforeach
+
+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_rpath : extra_args.get('install_rpath', ''),
+ install_dir : installed_tests_execdir,
+ install : install,
+ )
+endforeach
+
+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: install,
+ install_mode: 'rwxr-xr-x',
)
- suite = ['gio'] + extra_args.get('suite', [])
- timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
- test(test_name, exe,
- env : test_env,
- timeout : timeout,
- suite : suite,
- args : ['--tap'],
- is_parallel : extra_args.get('is_parallel', true),
+ 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,
)
- endforeach
+ endif
endforeach
-foreach program_dict : test_extra_programs
- foreach program_name, extra_args : program_dict
- 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,
- )
- endforeach
-endforeach
+# TAP test runner for Python tests
+if installed_tests_enabled
+ install_data(
+ files('taptestrunner.py'),
+ install_dir: installed_tests_execdir,
+ )
+endif
-# FIXME: subdir('services')
+subdir('services')
subdir('modules')