[Spice-devel] [PATCH spice-gtk v6 14/18] build: Use a convenience library for tests
Frediano Ziglio
fziglio at redhat.com
Thu Sep 5 13:42:37 UTC 2019
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 at redhat.com>
---
tests/meson.build | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/meson.build b/tests/meson.build
index 39eac9c9..57bd2cc5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -21,12 +21,18 @@ if spice_gtk_has_polkit
]
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- at 0@'.format(src).split('.')[0]
exe = executable(name,
sources : src,
c_args : '-DTESTDIR="@0@"'.format(meson.current_build_dir()),
- objects : spice_client_glib_lib.extract_all_objects(),
+ link_with : test_lib,
dependencies : spice_client_glib_dep)
if not name.contains('mock-acl-helper')
test(name, exe)
--
2.20.1
More information about the Spice-devel
mailing list