mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
meson: gio/tests: add more missing tests
This commit is contained in:
parent
f438c04fac
commit
34e4e25d53
@ -341,8 +341,9 @@ if host_system != 'windows'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# This is also used by tests/gdbus-daemon, so use files() to include the path
|
||||||
gdbus_daemon_sources = [
|
gdbus_daemon_sources = [
|
||||||
'gdbusdaemon.c',
|
files('gdbusdaemon.c'),
|
||||||
gdbus_daemon_generated,
|
gdbus_daemon_generated,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
23
gio/tests/gdbus-object-manager-example/meson.build
Normal file
23
gio/tests/gdbus-object-manager-example/meson.build
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# FIXME: set UNINSTALLED_GLIB_{SRC|BUILD}DIR=top_{src|build}dir ?
|
||||||
|
gdbus_example_objectmanager_generated = custom_target('gdbus-example-objectmanager-generated',
|
||||||
|
input : ['gdbus-example-objectmanager.xml'],
|
||||||
|
output : ['gdbus-example-objectmanager-generated.h',
|
||||||
|
'gdbus-example-objectmanager-generated.c',
|
||||||
|
'gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Animal.xml',
|
||||||
|
'gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml'],
|
||||||
|
command : [python, gdbus_codegen,
|
||||||
|
'--interface-prefix', 'org.gtk.GDBus.Example.ObjectManager.',
|
||||||
|
'--c-namespace', 'Example',
|
||||||
|
'--c-generate-object-manager',
|
||||||
|
'--generate-c-code', '@OUTDIR@/gdbus-example-objectmanager-generated',
|
||||||
|
'--generate-docbook', '@OUTDIR@/gdbus-example-objectmanager-generated',
|
||||||
|
'@INPUT@'])
|
||||||
|
|
||||||
|
libgdbus_example_objectmanager = shared_library('libgdbus-example-objectmanager',
|
||||||
|
gdbus_example_objectmanager_generated,
|
||||||
|
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
|
||||||
|
dependencies : [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep],
|
||||||
|
install : false)
|
||||||
|
|
||||||
|
libgdbus_example_objectmanager_dep = declare_dependency(sources : gdbus_example_objectmanager_generated,
|
||||||
|
link_with : libgdbus_example_objectmanager)
|
45
gio/tests/gengiotypefuncs.py
Normal file
45
gio/tests/gengiotypefuncs.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
debug = os.getenv('GIO_GENTYPEFUNCS_DEBUG') is not None
|
||||||
|
|
||||||
|
out_file = sys.argv[1]
|
||||||
|
in_files = sys.argv[2:]
|
||||||
|
|
||||||
|
funcs = []
|
||||||
|
|
||||||
|
|
||||||
|
if debug: print ('Output file: ', out_file)
|
||||||
|
|
||||||
|
if debug: print (len(in_files), 'input files')
|
||||||
|
|
||||||
|
for filename in in_files:
|
||||||
|
if debug: print ('Input file: ', filename)
|
||||||
|
with open(filename, "r") as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.rstrip('\n').rstrip('\r')
|
||||||
|
# print line
|
||||||
|
match = re.search(r'\bg_[a-zA-Z0-9_]*_get_type\b', line)
|
||||||
|
if match:
|
||||||
|
func = match.group(0)
|
||||||
|
if not func in funcs:
|
||||||
|
funcs.append(func)
|
||||||
|
if debug: print ('Found ', func)
|
||||||
|
|
||||||
|
file_output = 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS\n'
|
||||||
|
|
||||||
|
funcs = sorted(funcs)
|
||||||
|
|
||||||
|
for f in funcs:
|
||||||
|
if f not in ['g_io_extension_get_type', 'g_settings_backend_get_type']:
|
||||||
|
file_output += '*tp++ = {0} ();\n'.format(f)
|
||||||
|
|
||||||
|
if debug: print (len(funcs), 'functions')
|
||||||
|
|
||||||
|
ofile = open(out_file, "w")
|
||||||
|
ofile.write(file_output)
|
||||||
|
ofile.close()
|
@ -1,3 +1,12 @@
|
|||||||
|
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@'])
|
||||||
|
|
||||||
# Test programs buildable on all platforms
|
# Test programs buildable on all platforms
|
||||||
gio_tests = [
|
gio_tests = [
|
||||||
'appmonitor',
|
'appmonitor',
|
||||||
@ -12,7 +21,7 @@ gio_tests = [
|
|||||||
'credentials',
|
'credentials',
|
||||||
'data-input-stream',
|
'data-input-stream',
|
||||||
'data-output-stream',
|
'data-output-stream',
|
||||||
#'defaultvalue', # FIXME: needs giotypefuncs.c generated
|
'defaultvalue',
|
||||||
'fileattributematcher',
|
'fileattributematcher',
|
||||||
'filter-streams',
|
'filter-streams',
|
||||||
'giomodule',
|
'giomodule',
|
||||||
@ -45,26 +54,39 @@ gio_tests = [
|
|||||||
'volumemonitor',
|
'volumemonitor',
|
||||||
'glistmodel',
|
'glistmodel',
|
||||||
'testfilemonitor',
|
'testfilemonitor',
|
||||||
]
|
|
||||||
|
|
||||||
gio_tests += [
|
|
||||||
'thumbnail-verification',
|
'thumbnail-verification',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Test programs buildable on UNIX only
|
test_extra_programs = [
|
||||||
|
['gdbus-connection-flush-helper'],
|
||||||
|
['gdbus-testserver'],
|
||||||
|
]
|
||||||
|
|
||||||
|
# Test programs buildable on UNIX only
|
||||||
if host_machine.system() != 'windows'
|
if host_machine.system() != 'windows'
|
||||||
gio_tests += [
|
gio_tests += [
|
||||||
'file',
|
'file',
|
||||||
#'gdbus-peer', Needs gdbus-object-manager-example/gdbus-example-objectmanager-generated.h
|
'gdbus-peer',
|
||||||
'gdbus-peer-object-manager',
|
'gdbus-peer-object-manager',
|
||||||
'gdbus-unix-addresses',
|
|
||||||
'live-g-file',
|
'live-g-file',
|
||||||
'socket-address',
|
'socket-address',
|
||||||
'stream-rw_all',
|
'stream-rw_all',
|
||||||
'unix-fd',
|
'unix-fd',
|
||||||
'unix-streams',
|
'unix-streams',
|
||||||
|
'mimeapps',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
test_extra_programs += [
|
||||||
|
['basic-application'],
|
||||||
|
['dbus-launch'],
|
||||||
|
['appinfo-test'],
|
||||||
|
['apps'],
|
||||||
|
]
|
||||||
|
|
||||||
|
have_dbus_daemon = find_program('dbus-daemon', required : false).found()
|
||||||
|
if have_dbus_daemon
|
||||||
|
gio_tests += ['gdbus-unix-addresses']
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cc.get_id() != 'msvc'
|
if cc.get_id() != 'msvc'
|
||||||
@ -83,16 +105,22 @@ test_c_args = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
foreach test_name : gio_tests
|
foreach test_name : gio_tests
|
||||||
src_file = '@0@.c'.format(test_name)
|
extra_deps = []
|
||||||
|
srcs = ['@0@.c'.format(test_name)]
|
||||||
# conflicts with glib/tests/autoptr, can't have two targets with same name
|
# conflicts with glib/tests/autoptr, can't have two targets with same name
|
||||||
if test_name == 'autoptr'
|
if test_name == 'autoptr'
|
||||||
test_name = 'autoptr-gio'
|
test_name = 'autoptr-gio'
|
||||||
|
elif test_name == 'defaultvalue'
|
||||||
|
srcs += [giotypefuncs_inc]
|
||||||
|
elif test_name == 'gdbus-peer'
|
||||||
|
# This is peer to peer so it doesn't need a session bus, so we can run
|
||||||
|
# it automatically as a test by default
|
||||||
|
extra_deps = [libgdbus_example_objectmanager_dep]
|
||||||
endif
|
endif
|
||||||
exe = executable(test_name, src_file,
|
exe = executable(test_name, srcs,
|
||||||
install : false,
|
install : false,
|
||||||
c_args : test_c_args,
|
c_args : test_c_args,
|
||||||
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
|
dependencies : [libglib_dep, libgmodule_dep, libgio_dep] + extra_deps)
|
||||||
)
|
|
||||||
if test_name == 'testfilemonitor'
|
if test_name == 'testfilemonitor'
|
||||||
test(test_name, exe, env : test_env, timeout : 45)
|
test(test_name, exe, env : test_env, timeout : 45)
|
||||||
else
|
else
|
||||||
@ -101,68 +129,59 @@ foreach test_name : gio_tests
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
uninstalled_test_extra_programs = [
|
uninstalled_test_extra_programs = [
|
||||||
'gio-du',
|
['gio-du'],
|
||||||
'echo-server',
|
['echo-server'],
|
||||||
'filter-cat',
|
['filter-cat'],
|
||||||
'gapplication-example-actions',
|
['gapplication-example-actions'],
|
||||||
'gapplication-example-cmdline',
|
['gapplication-example-cmdline'],
|
||||||
'gapplication-example-cmdline2',
|
['gapplication-example-cmdline2'],
|
||||||
'gapplication-example-cmdline3',
|
['gapplication-example-cmdline3'],
|
||||||
'gapplication-example-dbushooks',
|
['gapplication-example-dbushooks'],
|
||||||
'gapplication-example-open',
|
['gapplication-example-open'],
|
||||||
'gdbus-example-export',
|
['gdbus-daemon', gdbus_daemon_sources],
|
||||||
'gdbus-example-own-name',
|
['gdbus-example-export'],
|
||||||
'gdbus-example-peer',
|
['gdbus-example-own-name'],
|
||||||
'gdbus-example-proxy-subclass',
|
['gdbus-example-peer'],
|
||||||
'gdbus-example-server',
|
['gdbus-example-proxy-subclass'],
|
||||||
'gdbus-example-subtree',
|
['gdbus-example-server'],
|
||||||
'gdbus-example-watch-name',
|
['gdbus-example-subtree'],
|
||||||
'gdbus-example-watch-proxy',
|
['gdbus-example-watch-name'],
|
||||||
'gsubprocess-testprog',
|
['gdbus-example-watch-proxy'],
|
||||||
'httpd',
|
['gsubprocess-testprog'],
|
||||||
'proxy',
|
['httpd'],
|
||||||
'resolver',
|
['proxy'],
|
||||||
'send-data',
|
['resolver'],
|
||||||
'socket-server',
|
['send-data'],
|
||||||
|
['socket-server'],
|
||||||
|
['socket-client', ['gtlsconsoleinteraction.c']],
|
||||||
|
['tls-certificate', ['gtesttlsbackend.c']],
|
||||||
|
['tls-interaction', ['gtesttlsbackend.c']],
|
||||||
|
# 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', [], [libgdbus_example_objectmanager_dep]],
|
||||||
|
['gdbus-example-objectmanager-server', [], [libgdbus_example_objectmanager_dep]],
|
||||||
|
['gdbus-test-fixture', [], [libgdbus_example_objectmanager_dep]],
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach extra_program : uninstalled_test_extra_programs
|
if host_machine.system() != 'windows'
|
||||||
exe = executable(extra_program, '@0@.c'.format(extra_program),
|
uninstalled_test_extra_programs += [['gdbus-example-unix-fd-client']]
|
||||||
|
endif
|
||||||
|
|
||||||
|
foreach extra_program : uninstalled_test_extra_programs + test_extra_programs
|
||||||
|
srcs = ['@0@.c'.format(extra_program[0])]
|
||||||
|
if extra_program.length() > 1
|
||||||
|
srcs += extra_program[1]
|
||||||
|
endif
|
||||||
|
extra_deps = []
|
||||||
|
if extra_program.length() > 2
|
||||||
|
extra_deps = extra_program[2]
|
||||||
|
endif
|
||||||
|
executable(extra_program[0], srcs,
|
||||||
install : false,
|
install : false,
|
||||||
c_args : test_c_args,
|
c_args : test_c_args,
|
||||||
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
|
dependencies : [libglib_dep, libgmodule_dep, libgio_dep] + extra_deps)
|
||||||
)
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
test_extra_programs = [
|
|
||||||
'gdbus-connection-flush-helper',
|
|
||||||
'gdbus-testserver',
|
|
||||||
]
|
|
||||||
|
|
||||||
exe = executable('tls-certificate', 'tls-certificate.c', 'gtesttlsbackend.c',
|
|
||||||
c_args : test_c_args,
|
|
||||||
dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
|
|
||||||
)
|
|
||||||
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],
|
|
||||||
)
|
|
||||||
|
|
||||||
#exe = executable('gdbus-daemon', 'gdbus-daemon.c', '../gdbusdaemon.c',
|
|
||||||
# #meson.build_root() + '/gio/gdbus-daemon-generated.c', # FIXME
|
|
||||||
# c_args : test_c_args,
|
|
||||||
# dependencies : [libglib_dep, libgmodule_dep, libgio_dep],
|
|
||||||
#)
|
|
||||||
#test('gdbus-daemon', exe, env : test_env)
|
|
||||||
|
|
||||||
# FIXME: Add resources test
|
# FIXME: Add resources test
|
||||||
|
|
||||||
foo = '''
|
foo = '''
|
||||||
|
@ -17,9 +17,17 @@ gobject_tests = [
|
|||||||
'ifaceproperties',
|
'ifaceproperties',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# FIXME: use new environment() object
|
||||||
|
# FIXME: put common bits of test environment() in one location
|
||||||
|
# Not entirely random of course, but at least it changes over time
|
||||||
|
random_number = minor_version.to_int() + meson.version().split('.').get(1).to_int()
|
||||||
|
|
||||||
test_env = [
|
test_env = [
|
||||||
'G_TEST_SRCDIR=' + meson.current_source_dir(),
|
'G_TEST_SRCDIR=' + meson.current_source_dir(),
|
||||||
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
|
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
|
||||||
|
'G_DEBUG=gc-friendly',
|
||||||
|
'MALLOC_CHECK_=2',
|
||||||
|
'MALLOC_PERTURB_=@0@'.format(random_number % 256),
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach test_name : gobject_tests
|
foreach test_name : gobject_tests
|
||||||
|
Loading…
Reference in New Issue
Block a user