spice-gtk/tests/meson.build
Frediano Ziglio 6ad2ec5a81 build: Use a convenience library for tests
Instead of linking all object inside spice-client-glib build a library
from these object and link to each test.
This will allow to override some object file for mocking purposes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-09-27 11:08:38 +01:00

41 lines
970 B
Meson

tests_sources = [
'util.c',
'coroutine.c',
'session.c',
'uri.c',
'file-transfer.c',
]
if spice_gtk_has_phodav
tests_sources += 'pipe.c'
endif
if spice_gtk_has_usbredir
tests_sources += 'cd-emu.c'
endif
if spice_gtk_has_polkit
tests_sources += [
'usb-acl-helper.c',
'mock-acl-helper.c',
]
endif
# create a static library from a shared one extracting all objects
# this allows to rewrite part of it if necessary for mocking
test_lib = \
static_library('test-lib',
objects : spice_client_glib_lib.extract_all_objects())
foreach src : tests_sources
name = 'test-@0@'.format(src).split('.')[0]
exe = executable(name,
sources : src,
c_args : '-DTESTDIR="@0@"'.format(meson.current_build_dir()),
link_with : test_lib,
dependencies : spice_client_glib_dep)
if not name.contains('mock-acl-helper')
test(name, exe)
endif
endforeach